diff options
Diffstat (limited to 'wiki/tmw_deploy.py')
-rwxr-xr-x | wiki/tmw_deploy.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/wiki/tmw_deploy.py b/wiki/tmw_deploy.py index 2f497d9..fc34904 100755 --- a/wiki/tmw_deploy.py +++ b/wiki/tmw_deploy.py @@ -11,6 +11,7 @@ with open("password.txt") as f: ## Setup (also handles cookies on its own due to Session) url = "https://wiki.themanaworld.org/api.php" S = requests.Session() +S.proxies={'https': "socks5://localhost:2121"} # <- Proxy mandatory #r=S.post("%s?action=edit&format=json" % url) @@ -28,9 +29,16 @@ login["lgtoken"]=token login["format"]="json" ## *Actual* Login -r=S.post("%s" % url, data=login) -assert r.status_code == 200 -assert r.json()['login']['result'] == "Success" +try: + r=S.post("%s" % url, data=login) + assert r.status_code == 200 + assert r.json()['login']['result'] == "Success" +except: + traceback.print_exc() + print(repr(r)) + print(r.text) + print("Also, make sure the IP you have used is allowed.") + exit(1) ## Retrieve CSRF Token r=S.get("%s?action=query&meta=tokens&format=json" % url) |