Skip to content

Instantly share code, notes, and snippets.

@newbiethetest
Created September 23, 2014 01:37
Show Gist options
  • Save newbiethetest/ee8375fed2ae529e1e67 to your computer and use it in GitHub Desktop.
Save newbiethetest/ee8375fed2ae529e1e67 to your computer and use it in GitHub Desktop.
class MysqlStordPipeline(object):
def __int__(self):
self.connect=MySQLdb.connect('localhost','root','123654','niaoyundb',charset='utf8', use_unicode=True)
self.cursors=self.connect.cursor()
def process_item(self,item,spider):
try:
self.cursors.execute("select version()")
except MySQLdb.Error,e:
print "Error %d: %s" % (e.args[0], e.args[1])
return item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment