You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ddvc falls back to 24.11.0 when a custom user_agent is passed #415
When a custom user_agent is passed to TgtgClient, the DataDome SDK request falls back to the default APK version 24.11.0 instead of the app version in the user agent.
line 81: self.user_agent = user_agent if user_agent else self._get_user_agent()
self.version is only set inside _get_user_agent() (lines 88-92), so it is never set when user_agent is passed.
line 133: apk_version = getattr(self, "version", DEFAULT_APK_VERSION), which is then sent as ddvc (line 139).
So with e.g. user_agent="TGTG/26.7.2 Dalvik/2.1.0 (...)", the API requests say app version 26.7.2 but the SDK request says ddvc=24.11.0, a version from two years ago.
Possible fix
Set self.version also when a custom user agent is given: parse it from the TGTG/<version> prefix, or accept an optional apk_version argument, and fall back to get_last_apk_version() / DEFAULT_APK_VERSION otherwise.
Context
Since about 20 November every request from my scanner (Der-Henning/tgtg v1.26.0, which uses this library) gets a 403 from DataDome, both token/v1/refresh with valid tokens and auth/v5/authByEmail, on apptoogoodtogo.com and on api.toogoodtogo.com (see #403 and #411), with or without a custom user agent. I don't know whether this mismatch causes the 403s, but it looks like an unintended inconsistency worth fixing.
Activity