ahivert / tgtg-python

Unofficial client for TooGoodToGo API
GNU General Public License v3.0
377 stars 72 forks source link

Captcha error #321

Open teHwHoly opened 1 month ago

teHwHoly commented 1 month ago

Hi,

your API worked amazing until now, thank you so much for it! Two days ago it started throwing this error:

Traceback (most recent call last):
  File "/toogood.py", line 24, in <module>
    items = client.get_items()
            ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/tgtg/__init__.py", line 244, in get_items
    self.login()
  File "/usr/local/lib/python3.11/dist-packages/tgtg/__init__.py", line 153, in login
    self._refresh_token()
  File "/usr/local/lib/python3.11/dist-packages/tgtg/__init__.py", line 139, in _refresh_token
    raise TgtgAPIError(response.status_code, response.content)
tgtg.exceptions.TgtgAPIError: (403, b'{"url":"https://geo.captcha-delivery.com/captcha/?initialCid= [..] "}')

Seems like they implemented some captcha method, didn't they? I left out some information of the URL ([..]). Does anybody else also get this error? I'm from Germany, just in case the changes done were regional.

Thanks!

lolmachine4 commented 1 month ago

I get the exact same error. Im using the tgtg-integration in home assistant and all sensors became unavaible this week. I tried to dig into what's going on and tried several solutions I found in the closed issue section here (using a different user-agent, changing APK-version), but that didn't fix it. Since I have zero knowledge in what I'm doing, that's all I could test.

I'm also from Germany, using TKOM. I tried several router reboots to switch IPs, but got the banned message every time on the first try. I don't think it's IP-related anyway because the app works flawless, I logged out of it an logged back in without any problem and did not have to solve a captcha.

Marow commented 4 weeks ago

Same here. Got Captcha 403 error when trying to get_items

Cruiser79 commented 4 weeks ago

I also got a 403 and the response with a captcha url. To solve the captcha didn't helped. So i stopped my tgtg application yesterday midday. I started it again this morning and everything was working. So maybe the solution is only: wait many hours, if you got a captcha!?

TanguyOrtegat commented 3 weeks ago

same here ... but when i log in:

Traceback (most recent call last): File "/home/test/tgtg/ToGoodToGoBot/toogoodtogo.py", line 118, in tgtg.login() File "/home/test/tgtg/ToGoodToGoBot/toogoodtogo.py", line 58, in login self.client.login() File "/home/test/.local/lib/python3.9/site-packages/tgtg/init.py", line 153, in login self._refresh_token() File "/home/test/.local/lib/python3.9/site-packages/tgtg/init.py", line 139, in _refresh_token raise TgtgAPIError(response.status_code, response.content) tgtg.exceptions.TgtgAPIError: (403, b'{"url":"https://geo.captcha-delivery.com/c

vandrham commented 3 weeks ago

I get the same when I run the login flow on a remote VPS and open the e-mail confirmation in a browser on my local browser (on a different IP address than the login call). When I perform both on the same source IP everything seems to work fine.

I suspect that the cookies that are the result of the login call are bound to the IP address of the caller and need to be confirmed using a browser session coming from the same IP address.