Add a useful exception error, telling the user to login for internet access
This commit is contained in:
1 parent
3c8274b166
commit
69c23e1b2e
1 file changed
+14
-5
@@ -17,7 +17,9 @@ from gui import GUIManager
|
|||||||
from channel import Channel
|
from channel import Channel
|
||||||
from websocket import WebsocketPool
|
from websocket import WebsocketPool
|
||||||
from inventory import DropsCampaign
|
from inventory import DropsCampaign
|
||||||
from exceptions import ExitRequest, RequestException, LoginException, CaptchaRequired
|
from exceptions import (
|
||||||
|
MinerException, RequestException, LoginException, CaptchaRequired, ExitRequest
|
||||||
|
)
|
||||||
from utils import task_wrapper, timestamp, AwaitableValue, OrderedSet, ExponentialBackoff
|
from utils import task_wrapper, timestamp, AwaitableValue, OrderedSet, ExponentialBackoff
|
||||||
from constants import (
|
from constants import (
|
||||||
BASE_URL,
|
BASE_URL,
|
||||||
@@ -731,10 +733,17 @@ class Twitch:
|
|||||||
payload.pop("authy_token", None)
|
payload.pop("authy_token", None)
|
||||||
payload.pop("twitchguard_code", None)
|
payload.pop("twitchguard_code", None)
|
||||||
for attempt in range(2):
|
for attempt in range(2):
|
||||||
async with self.request(
|
try:
|
||||||
"POST", "https://passport.twitch.tv/login", json=payload
|
async with self.request(
|
||||||
) as response:
|
"POST", "https://passport.twitch.tv/login", json=payload
|
||||||
login_response: JsonType = await response.json()
|
) as response:
|
||||||
|
login_response: JsonType = await response.json()
|
||||||
|
except aiohttp.ContentTypeError as exc:
|
||||||
|
raise MinerException(
|
||||||
|
"Unexpected content type returned instead of JSON, "
|
||||||
|
"usually due to being redirected. "
|
||||||
|
"Do you need to login for internet access?"
|
||||||
|
) from exc
|
||||||
|
|
||||||
# Feed this back in to avoid running into CAPTCHA if possible
|
# Feed this back in to avoid running into CAPTCHA if possible
|
||||||
if "captcha_proof" in login_response:
|
if "captcha_proof" in login_response:
|
||||||
|
|||||||
Reference in new issue
Block a user