Sid72020123 / scratchconnect

Python Library to connect Scratch API and much more.
https://sid72020123.github.io/scratchconnect/
MIT License
26 stars 14 forks source link

Make the ForbiddenLogin exception more descriptive #34

Closed Chiroyce1 closed 2 years ago

Chiroyce1 commented 2 years ago

Since a lot of users are having issues with ForbiddenLogin, I decided to make the message a bit more descriptive so that they can fix the issue more quickly.

Sid72020123 commented 2 years ago

Thank you so much for the PR. I will merge this and upload to pypi in the next version of ScratchConnect...

suvidhpawar commented 2 years ago

Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/scratchconnect/ScratchConnect.py", line 56, in _login request.json() File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/usr/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 8, in login = scratchconnect.ScratchConnect("pawarsuvidh", "10085678") File "/opt/virtualenvs/python3/lib/python3.8/site-packages/scratchconnect/ScratchConnect.py", line 33, in init self._login(cookie=False, auto_cookie_login=self.auto_cookie_login) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/scratchconnect/ScratchConnect.py", line 62, in _login raise Exceptions.ForbiddenLogin( scratchconnect.Exceptions.ForbiddenLogin: Scratch is not letting you login from this device. Try again later or from another device.

Sid72020123 commented 2 years ago

@suvidhpawar Are you trying to login from replit? Try cookie login instead or try in your local computer...