Better errors (#26)

* Improved error reporting in the login functions

* Bumped Version to 1.2.1

* autopep8 action fixes (#27)
This commit is contained in:
Peter Taylor 2022-03-12 23:32:17 +00:00 committed by GitHub
parent 36498a88b4
commit fb10162033
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -4,6 +4,9 @@ from bs4 import BeautifulSoup as soup
import requests
warning = "Will print the response text (Please be careful as this may contain personal data or allow others to login to your account):"
def LoginWeb(user, password):
session = requests.Session()
@ -30,10 +33,16 @@ def LoginAPI(user, password):
"password": password,
"source": "desktop"})
if r.status_code != 200:
print(f"Error: {r.status_code} is not 200")
print(warning)
print(r.text)
raise RuntimeError
t = json.loads(r.text)
if not t["success"]:
print(f"Error: success key is not true")
print(warning)
print(r.text)
raise RuntimeError
return t["key"]["key"]

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "itchiodl"
version = "1.2.0"
version = "1.2.1"
description = "Python Scripts for downloading / archiving your itchio library"
authors = ["Peter Taylor <me@et1.uk>"]
license = "MIT"