Skip to content

Commit

Permalink
Merge pull request #6166 from Xairooo/patch-2
Browse files Browse the repository at this point in the history
Fixing proxies
  • Loading branch information
MerlionRock authored Jul 30, 2017
2 parents f3a5f13 + d5d2d1f commit 1649be6
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions MultiBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 1649be6

Please sign in to comment.