frissyn / valorant.py

Complete Python interface for the Valorant API. Works right out of the box!
https://valorantpy.readthedocs.io
MIT License
125 stars 19 forks source link

AttributeError: 'NoneType' object has no attribute 'replace' #8

Closed allexus13 closed 3 years ago

allexus13 commented 3 years ago

LOCALE = locale.getlocale()[0].replace("_", "-") AttributeError: 'NoneType' object has no attribute 'replace'

allexus13 commented 3 years ago

also in values.py:

REIGONS = [ "eu", "eune", "euw", "jp", "kr", "lan", "br", "las", "na", "oce", "ru", "tr", "latam", "ap" ]

should be REGIONS. minor typo but might cause issues

allexus13 commented 3 years ago

for those who encountered this problem, I edited the "values.py" file from the library and changed:

LOCALE = locale.getlocale()[0].replace("_", "-")

to

LOCALE = locale.getdefaultlocale()[0].replace("_", "-")

I also edited the "client.py" file and fixed the typo in REIGON (REGION not a big deal though)

and then from the documentation (quickstart) instead of:

`import os import valorant

KEY = os.environ["KEY"] client = valorant.Client(KEY, locale=None)

maps = client.get_maps() agents = client.get_characters()

print(agents.get("Viper")) print(maps.get("Ascent")) ` and instead of

`import os import valorant

API_KEY = os.getenv("API_KEY") client = valorant.Client(API_KEY)

agents = client.get_characters()

for agent in agents: print(agent.name, agent.id)`

I did:

`import valorant

api_key = "REPLACE_WITH_YOUR_API_KEY" client = valorant.Client(api_key, locale=None)

maps = client.get_maps() agents = client.get_characters()

print(agents.get("Viper")) print(maps.get("Ascent"))`