From fb101620333b5e59ccea19f8caf1bc742366e0a8 Mon Sep 17 00:00:00 2001 From: Peter Taylor Date: Sat, 12 Mar 2022 23:32:17 +0000 Subject: [PATCH] Better errors (#26) * Improved error reporting in the login functions * Bumped Version to 1.2.1 * autopep8 action fixes (#27) --- itchiodl/login.py | 9 +++++++++ pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/itchiodl/login.py b/itchiodl/login.py index e0b9121..fd5d9ed 100644 --- a/itchiodl/login.py +++ b/itchiodl/login.py @@ -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"] diff --git a/pyproject.toml b/pyproject.toml index bbc2823..3b27bc4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "MIT"