ahivert/tgtg-python

I have a 403 error that disappears as soon as I change the default `en-UK` language

Closed this issue · 6 comments

pchr8 commented

An observation that may or may not be helpful to other people: my 403 errors goes away as soon as I change the language.

The default en-UK instantly fails for me, but literally anything else doesn't - including lowercase en-uk and invalid/not-existing-language-codes. This holds over multiple networks, multiple IPs and at least two accounts.

Going into the rabbit hole - it seems en-UK is not a valid/frequent locale. RFC 5646 considers it an OK synonym for en-GB, but various discussions on the Internet have stronger opinions: php - Is en_UK an illegal locale? - Stack Overflow. Android seems to use `en-GB: android - Localization for Canada defaults to UK; should default to US - Stack Overflow

My point is that en-UK seems special and if it's not used often elsewhere, and may be a strong signal pointing to tgtg-python use.

Changing the default value to en-GB (or en-US as it's a larger market?..) is a low-cost change that might help a fraction of users, or in any case - shouldn't make matters worse

hey,

This saved my life! changing manually to en-GB i don't have captcha issues anymore

I am having the same issue. Where does one change default value to en-GB?

tjorim commented

It's actually language, not language_code:

>>> client = TgtgClient()
Using version 23.9.2
>>> client = TgtgClient(language_code="en-GB")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: TgtgClient.__init__() got an unexpected keyword argument 'language_code'
>>> client = TgtgClient(language="en-GB")
Using version 23.9.2

I change login.py to:

`from tgtg import TgtgClient

client = TgtgClient(email="your@email.com")
credentials = client.get_credentials()
language_code="en-GB"

print(credentials)
`

and items.py to:

`from tgtg import TgtgClient

client = client = TgtgClient(access_token='youraccesstoken', refresh_token='yourrefreshtoken', user_id="youruserid", cookie='yourcookieinfo', language="en-GB")

items = client.get_items()
print(items)`

works fine for me now. Thank you for the help !!

Check if you're affected:

  • Run pip show tgtg and see if it produces Version: 0.16.0
  • Check the source code of your library:
    # grep -R "en-UK" /usr/local/lib/python3.9/dist-packages
    /usr/local/lib/python3.9/dist-packages/tgtg/__init__.py:46:        language="en-UK",
    

To fix, upgrade the library

pip install tgtg --upgrade