Please enable JS and disable any ad blocker
Closed this issue · 26 comments
Hi,
Since a few days / weeks I'm receiving an error.
Every 10 minutes I'm checking if there are new items available in tgtg.
3 accounts are used in the code, it changes frequently who's getting the error, sometimes 1 account, sometimes 2 of them.
The error message:
(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\':\'AHrlqAAAAAMAcU7SCObNTwsBKgIYEaQFwwACETL__ih5Nw==\',\'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')
recently encountered the same problem :(
I'm still having the issue too.
Is anyone currently able to use the API without issue ?
Hi, I’m currently writing and testing my script, it works well, I only have a problem with the range
That looks like you are redirected to a captcha; no ?
"'geo.captcha-delivery.com"
Lately I have been receiving the same error from login attempts carried out from my AWS hosted service.
If I run the same service locally on my PC, then the login attempt is successful.
I am using the same account in both cases. Maybe Tgtg introduced some sort of check on IP? What would you suggest if this was the case?
i've changed the user_agent header of tgtg_client package by mine and the auth worked for me.
edit from tgtg client lib (__init__.py):
USER_AGENTS = [
# "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/M4B30Z)",
# "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 7.0; SM-G935F Build/NRD90M)",
# "TGTG/21.12.1 Dalvik/2.1.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K)",
"TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)"
]
I would suggest changing the version to 22.5.5 as this is the latest version on android
As of todays morning I'm having the same issue. Any progress?
I've published 0.11.3 version. User agent updated to 22.5.5
Upon upgrade to the 0.11.3 version (user agent version updated to 22.5.5), I'm no longer getting 403 Errors on retrieval of stores, however when using the login feature, I'm still getting 403. Anyone has the same problem? Is it possible the API endpoint changed?
using the login feature, I'm still getting 403. Anyone has the same problem?
got the same problem with 403
Just tried with last version 0.11.3. Looks like it works on my side. Could be linked to your IP.
>>> client = TgtgClient(email="<email>")
>>> client.login()
Check your mailbox on PC to continue... (Mailbox on mobile won't work, if you have installed tgtg app.)
Check your mailbox on PC to continue... (Mailbox on mobile won't work, if you have installed tgtg app.)
Logged in!
>>> client.get_items()
[{'item': {'item_id': '597999', 'sa...
i've changed the user_agent header of tgtg_client package by mine and the auth worked for me.
edit from tgtg client lib (init.py):
USER_AGENTS = [ # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/M4B30Z)", # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 7.0; SM-G935F Build/NRD90M)", # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K)", "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)" ]
change to this and it works again
the last version 0.11.3 include these changes
i've changed the user_agent header of tgtg_client package by mine and the auth worked for me.
edit from tgtg client lib (init.py):USER_AGENTS = [ # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/M4B30Z)", # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; U; Android 7.0; SM-G935F Build/NRD90M)", # "TGTG/21.12.1 Dalvik/2.1.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K)", "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)" ]
change to this and it works again
FYI custom user agent can be given to the client when you build it:
TgtgClient(user_agent="<your_custom_user_agent>", email="<your_email>")
got the same problem with 403 today
Hi,
Can we just fill in some random user agent?
Or how can we get the correct one?
@brouckaertd use this one only, worked for me:
"TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)"
@TanguyOrtegat Thanks, added the user agent you mentioned when I create the client.
It's now working again.
with the time they remove old app version to their api security polity.
we can do a web scrap on app info from playstore, but finally, this is just a time question, because all of this is outdated after any update on their side.
easy trick: just go to playstore app page, about section at the bottom, and search app version
The issue is more subtle: tgtg-python
already uses a newer user agent than the one mentioned by @TanguyOrtegat, check out commit ef720c4 (May 18, 2022):
diff --git a/pyproject.toml b/pyproject.toml
index 8066af8..6203380 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tgtg"
-version = "0.11.2"
+version = "0.11.3"
description = "Unoffical python client for TooGoodToGo API"
readme = "README.md"
authors = ["Anthony Hivert <anthony.hivert@gmail.com>"]
diff --git a/tgtg/__init__.py b/tgtg/__init__.py
index 63c8ed8..32387a6 100644
--- a/tgtg/__init__.py
+++ b/tgtg/__init__.py
@@ -17,9 +17,9 @@
ACTIVE_ORDER_ENDPOINT = "order/v6/active"
INACTIVE_ORDER_ENDPOINT = "order/v6/inactive"
USER_AGENTS = [
- "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/M4B30Z)",
- "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 7.0; SM-G935F Build/NRD90M)",
- "TGTG/22.2.1 Dalvik/2.1.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K)",
+ "TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 6.0.1; Nexus 5 Build/M4B30Z)",
+ "TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 7.0; SM-G935F Build/NRD90M)",
+ "TGTG/22.5.5 Dalvik/2.1.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K)",
]
DEFAULT_ACCESS_TOKEN_LIFETIME = 3600 * 4 # 4 hours
MAX_POLLING_TRIES = 24 # 24 * POLLING_WAIT_TIME = 2 minutes
So the answer is, unfortunately, somewhat more tricky than a simple "always use the latest app version".
User agent "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)" seems to get 403 errors still.
User agent "TGTG/22.2.1 Dalvik/2.1.0 (Linux; U; Android 9; SM-G955F Build/PPR1.180610.011)" as mentioned by @TanguyOrtegat works for me, at least for retrieval of magic bags.
Haven't tested retrieving new credentials, but I know I previously had an issue where user agent would work for retrieving magic bags but with using the same user agent for login (-> retrieval of new credentials) would throw 403.
After I put a new list of agents with a new version in it, it worked
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 9; nami Build/R100-14526.69.0",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; RMX2075 Build/RKQ1.211103.002",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 5.0; O21S Build/LRX21M",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 8.1.0; Joy 1 Build/OPM1.171019.026",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; T602DL Build/SP1A.210812.016",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; 22041219C Build/SP1A.210812.016",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 9; H8266 Build/52.0.A.3.202",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; motorola edge 20 Build/S1RGS32.53-18-11-4",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 10; M20 Mini Build/QP1A.190711.020",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; Pixel 4a Build/SQ3A.220605.009.A1",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 12; CPH2399 Build/SP1A.210812.016",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 10; SM-T837A Build/QP1A.190711.020",
"TGTG/22.5.5 Dalvik/1.6.0 (Linux; U; Android 4.4.2; SM-T230NT Build/KOT49H",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 7.0; Alcatel 5085C Build/NRD90M",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 11; itel A551L Build/RP1A.201005.001",
"TGTG/22.5.5 Dalvik/2.1.0 (Linux; U; Android 9; AFTKA Build/PS7285.2877N",