class InformationjectPipeline:
def open_spider(self,spider):
self.conn=pymysql.connect(host='',user='',password='',db='')
def process_item(self,item,spider):
self.conn.query(
"insert infor (date_,item_,info_)"
"values('{}','{}','{}')".format(
item['date'],item['time'],item['info']
)
)
self.conn.commit()
def close_spider(self,spider):
self.conn.close()