logger = config.logger['explorer'] logging.getLogger("requests").setLevel(logging.WARNING) _file = logger['path'] + logger['filename'] logging.basicConfig( filename=_file, filemode='a', format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s', datefmt='%H:%M:%S', level=logging.DEBUG) logging.getLogger("requests").setLevel(logging.WARNING) logging.getLogger("urllib3").setLevel(logging.CRITICAL) _logging = logging.getLogger('explorer') _logging.addHandler(logging.StreamHandler(sys.stdout)) prod = False redis_conn = config.redis_conn() conf = { 'rpc_port': 6268, 'user_name': 'multichainrpc', 'password': '******', 'root': '1U4CEBPxBEPordqBrXuYf5ypRXsoHnEeRF9ouw', 'burn_address': '1XXXXXXWhKXXXXXXqXXXXXXXTxXXXXXXb1d3Yd' } if prod: conf['password'] = '******' conf['rpc_port'] = 4258 conf['root'] = '1SiHjBKisFnLRZrRRX2v54aq6qx5dKyKB1Ws97' conf['burn_address'] = '1XXXXXXX97XXXXXXAxXXXXXXgGXXXXXXYNhbVR'
socket.create_connection = function_hook_parameter(socket.create_connection, 3, "source_address", (myip, 0)) requests.packages.urllib3.util.connection.create_connection = function_hook_parameter( requests.packages.urllib3.util.connection.create_connection, 3, "source_address", (myip, 0) ) # 我就是在PyCharm里一步步Ctrl点击发现的这requests复制了一份socket.create_connection的代码并加上了新功能 从而绕过了socket.create_connection,藏的这么深Orz else: myip = "" DOMAIN = "http://www.cc98.org" # 假设当前网络能访问到本域名 conn = db() # 建立数据库连接,如果数据库连接失败 不处理异常 直接退出 myredis = redis_conn() # 建立redis连接 def createTable(boardid, big=""): """ 建表函数 需要传入板块id 和 大表前缀("big"或""),尝试进行建表sql语句,忽视错误(如表已经存在) :param boardid: 板块id,如"100" :param big: 传入空字符串表示普通表如bbs_100,传入"big"表示历史大表 如bigbbs_100 :return: """ sql = """ CREATE TABLE `{big}bbs_{boardid}` ( `id` int(11) NOT NULL, `lc` int(255) NOT NULL, `posttime` datetime NOT NULL, `edittime` datetime NOT NULL,