mirror of
https://github.com/Emersont1/itchio.git
synced 2026-03-11 08:54:39 +00:00
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:
parent
36498a88b4
commit
fb10162033
2 changed files with 10 additions and 1 deletions
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in a new issue