From d5d2d1f3858a868759f40dc5029e81d37e8f0f7c Mon Sep 17 00:00:00 2001 From: Xairooo Date: Sun, 30 Jul 2017 17:03:04 +0200 Subject: [PATCH] Fixing proxies --- MultiBot.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/MultiBot.py b/MultiBot.py index 34a9e0df4d..26c1c66efd 100644 --- a/MultiBot.py +++ b/MultiBot.py @@ -47,7 +47,7 @@ def getProxy(): headers = {'user-agent': 'Niantic App'} if requests.get('https://pgorelease.nianticlabs.com/plfe/', headers=headers, proxies=proxies).status_code == 200: headers = {'user-agent': 'pokemongo/1 CFNetwork/758.5.3 Darwin/15.6.0'} - if requests.get('https://sso.pokemon.com/', headers=headers, proxies=proxies).status_code != 404: + if requests.get('https://sso.pokemon.com/', headers=headers, proxies=proxies).status_code == 200: return proxy else: Lprint ("Proxy is Banned") @@ -147,16 +147,18 @@ def MakeConf(CurThread, username, password): stop() except: jsonData.items().append("{u'websocket':,{u'server_url': u'" + MultiBotConfig[u'WebSocket'][u'IP'] + ":" + str(MultiBotConfig[u'WebSocket'][u'Port'] + CurThread) + "u'start_embedded_server': True}") - else: + elif not MultiBotConfig[u'WebSocket'][u'start_embedded_server']: try: del jsonData[u'websocket'] except KeyboardInterrupt: stop() + except: + pass with open('configs/temp/config-' + str(CurThread) + '.json', 'w') as s: s.write(json.dumps(jsonData)) s.close() - + except IOError: Lprint ('config file error') time.sleep(30) @@ -184,17 +186,14 @@ def run(self): Lprint ('Thread-{0} using account {1}'.format(self.CurThread, self.username)) try: MakeConf(self.CurThread, self.username, self.password) + StartCmd = "python pokecli.py -af configs/temp/auth-{0}.json -cf configs/temp/config-{0}.json --walker_limit_output {1}".format(self.CurThread, MultiBotConfig[u'walker_limit_output']) if MultiBotConfig[u'UseProxy']: self.proxy = getProxy() if platform.system() == "Linux": - os.system('export HTTP_PROXY="http://' + proxy + '"; export HTTPS_PROXY="https://' + proxy + '"') + os.system('export HTTP_PROXY="http://' + proxy + '"; export HTTPS_PROXY="https://' + proxy + '"; ' + StartCmd) if platform.system() == "Windows": - Lprint ("Proxy on Windows not Supported yet, exit in 15s") - time.sleep (15) - stop() - os.system( - "python pokecli.py -af configs/temp/auth-{0}.json -cf configs/temp/config-{0}.json --walker_limit_output {1}".format( - self.CurThread, MultiBotConfig[u'walker_limit_output'])) + os.system('set HTTP_PROXY="http://' + proxy + '" & set HTTPS_PROXY="https://' + proxy + '" & ' + StartCmd) + os.system(StartCmd) except Exception as e: import traceback Lprint ((e))