MCPcopy
hub / github.com/luyishisi/Anti-Anti-Spider / ConnectDB

Function ConnectDB

原Anti-Anti-Spider/UrlSpider/model/UrlSpider.py:166–178  ·  view source on GitHub ↗

Connect MySQLdb

()

Source from the content-addressed store, hash-verified

164
165
166def ConnectDB():
167 "Connect MySQLdb "
168 connect, cursor = None, None
169 while True:
170 try:
171 connect = MySQLdb.connect(
172 host=HOST, user=USER, passwd=PASSWD, db=DB, port=PORT, charset='utf8')
173 cursor = connect.cursor()
174 break
175 except MySQLdb.Error, e:
176 print "Error %d: %s" % (e.args[0], e.args[1])
177 time.sleep(60)#防止出现永远循环
178 return connect, cursor
179
180
181def Thread_Handle(taskList, Total_TaskNum):

Callers 2

runMethod · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected