ahivert/tgtg-python

ERROR: Please enable JS and disable any ad blocker

Closed this issue · 1 comments

Hi
When I run the example code:

from tgtg import TgtgClient

client = TgtgClient(email="MY_EMAIL")
credentials = client.get_credentials()
print(credentials)

I get the following error:

Using version 22.9.3
Traceback (most recent call last):
  File "c:\Users\noahe\Documents\New folder\TooGoodToGoAPI\test.py", line 4, in <module>
    credentials = client.get_credentials()
  File "C:\Users\noahe\AppData\Local\Programs\Python\Python310\lib\site-packages\tgtg\__init__.py", line 84, in get_credentials
    self.login()
  File "C:\Users\noahe\AppData\Local\Programs\Python\Python310\lib\site-packages\tgtg\__init__.py", line 165, in login
    raise TgtgLoginError(response.status_code, response.content)
tgtg.exceptions.TgtgLoginError: (403, b'<html><head><title>apptoogoodtogo.com</title><style>#cmsg{animation: A 1.5s;}@keyframes A{0%{opacity:0;}99%{opacity:0;}100%{opacity:1;}}</style></head><body style="margin:0"><p id="cmsg">Please enable JS and disable any ad blocker</p><script data-cfasync="false">var dd={\'cid\':\'AHrlqAAAAAMAW2DhqabU-kkAVMKRdQ==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35587,\'e\':\'909f1806ea8d443b7bc63b6fd4c1b2cdc65e35d28d26aafcface1c77b0d34a0f\',\'host\':\'geo.captcha-delivery.com\'}</script><script data-cfasync="false" src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

"Please enable JS and disable any ad blocker"/"ERROR 403" seems to be a default error if an invalid request has been detected. (https://www.reddit.com/r/learnjavascript/comments/skbokf/fetch_request_from_server_to_web_api_returns/)

Is it possible that a recent API change on their part broke the code?
Thanks for looking into it!

EDIT:
I instantly get the error and don't receive an email.

Turns out I was using 2 instances on the same network, which tgtg doesn't allow.
So a rookie mistake on my part...