Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 403 #13

Closed
maartenhendrix opened this issue Nov 19, 2021 · 10 comments
Closed

Error 403 #13

maartenhendrix opened this issue Nov 19, 2021 · 10 comments
Labels
bug Something isn't working upstream module All issues that are dependend of the tgtg-python module

Comments

@maartenhendrix
Copy link
Collaborator

maartenhendrix commented Nov 19, 2021

I’m getting this error when logging in:

Logger:
homeassistant.components.sensor
Source: custom_components/tgtg/sensor.py:113 
Integration: Sensor (documentation, issues) 
First occurred: 9:15:52 PM (1 occurrences) 
Last logged: 9:15:52 PM

Error while setting up tgtg platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tgtg/sensor.py", line 63, in setup_platform
    add_entities([TGTGSensor(each_item_id)])
  File "/config/custom_components/tgtg/sensor.py", line 81, in __init__
    self.update()
  File "/config/custom_components/tgtg/sensor.py", line 113, in update
    tgtg_answer = tgtg_client.get_item(item_id=self.item_id)
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 180, in get_item
    self.login()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 106, in login
    self._refresh_token()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 91, in _refresh_token
    raise TgtgAPIError(response.status_code, response.content)
tgtg.exceptions.TgtgAPIError: (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>var dd={\'cid\':\'AHrlqAAAAAMAhDZvcVAoZ5oBKhA3gReKAABmQr8Yv76uRg==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35560,\'host\':\'geo.captcha-delivery.com\'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')
@maartenhendrix
Copy link
Collaborator Author

maartenhendrix commented Nov 19, 2021

Probably related to Upstream ticket

@Chouffy
Copy link
Owner

Chouffy commented Nov 30, 2021

Hey @maartenhendrix thanks for your issue. Indeed it's on the upstream side, let's see if this can be corrected 🤞 ahivert/tgtg-python#127

@Chouffy Chouffy added bug Something isn't working upstream module All issues that are dependend of the tgtg-python module labels Nov 30, 2021
@Chouffy
Copy link
Owner

Chouffy commented Dec 3, 2021

The new release should fix that, if not please reopen :)

@Chouffy Chouffy closed this as completed Dec 3, 2021
@maartenhendrix
Copy link
Collaborator Author

Looks like the problem is back. Or it is a new problem. Not sure:

This error originated from a custom integration.

Logger: homeassistant.components.sensor
Source: custom_components/tgtg/sensor.py:108 
Integration: Sensor 
First occurred: 9:56:20 AM (1 occurrences) 
Last logged: 9:56:20 AM

Error while setting up tgtg platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tgtg/sensor.py", line 58, in setup_platform
    add_entities([TGTGSensor(each_item_id)])
  File "/config/custom_components/tgtg/sensor.py", line 76, in __init__
    self.update()
  File "/config/custom_components/tgtg/sensor.py", line 108, in update
    tgtg_answer = tgtg_client.get_item(item_id=self.item_id)
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 235, in get_item
    self.login()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 119, in login
    self._refresh_token()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 109, in _refresh_token
    raise TgtgAPIError(response.status_code, response.content)
tgtg.exceptions.TgtgAPIError: (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>var dd={\'cid\':\'AHrlqAAAAAMAXdNK6PhIKToBKhA3gReKAABmQr8Yv76uRg==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35560,\'host\':\'geo.captcha-delivery.com\'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

@Chouffy
Copy link
Owner

Chouffy commented Dec 10, 2021

This is on the tgtg-python side of things, and it seems to have been solved some days ago: ahivert/tgtg-python#127
Can you try again with new tokens that you can create using the script?

@maartenhendrix
Copy link
Collaborator Author

I will try when I get home tomorrow

@maartenhendrix
Copy link
Collaborator Author

Still not working after adding new tokens:

Logger: homeassistant.components.sensor
Source: custom_components/tgtg/sensor.py:108
Integration: Sensor (documentation, issues)
First occurred: 3:13:42 PM (1 occurrences)
Last logged: 3:13:42 PM

Error while setting up tgtg platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/tgtg/sensor.py", line 58, in setup_platform
    add_entities([TGTGSensor(each_item_id)])
  File "/config/custom_components/tgtg/sensor.py", line 76, in __init__
    self.update()
  File "/config/custom_components/tgtg/sensor.py", line 108, in update
    tgtg_answer = tgtg_client.get_item(item_id=self.item_id)
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 238, in get_item
    self.login()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 119, in login
    self._refresh_token()
  File "/usr/local/lib/python3.9/site-packages/tgtg/__init__.py", line 109, in _refresh_token
    raise TgtgAPIError(response.status_code, response.content)
tgtg.exceptions.TgtgAPIError: (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>var dd={\'cid\':\'AHrlqAAAAAMAQQk79rBFKPgBKhA3gReKAABmQr8Yv76uRg==\',\'hsh\':\'1D42C2CA6131C526E09F294FE96F94\',\'t\':\'fe\',\'r\':\'b\',\'s\':35560,\'host\':\'geo.captcha-delivery.com\'}</script><script src="https://ct.captcha-delivery.com/c.js"></script></body></html>\n')

@Chouffy
Copy link
Owner

Chouffy commented Dec 13, 2021

Unfortunately I cannot help a lot here, as this is an issue on the upstream module tgtg-python ... could you create an issue here?

@maartenhendrix
Copy link
Collaborator Author

Okay, thanks

@sanya8923
Copy link

Hi! Did it solve the problem?
tgtg.exceptions.TgtgAPIError: (403, b'{"url":"https://geo.captcha-delivery.com/captcha/...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream module All issues that are dependend of the tgtg-python module
Projects
None yet
Development

No branches or pull requests

3 participants