e4c6 / eksi_unofficial_api

Ekşisözlük.com Unofficial API docs & client
MIT License
35 stars 7 forks source link

Assertion Error on initialization #17

Closed yasinkaraaslan closed 2 years ago

yasinkaraaslan commented 2 years ago
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.eksisozluk.com:443
DEBUG:urllib3.connectionpool:https://api.eksisozluk.com:443 "POST /Token HTTP/1.1" 400 104
Traceback (most recent call last):
  File "D:\eksisozluk\main.py", line 3, in <module>
    client = EksiApi(username='<myUsername>', password='<myPassword>')  # or EksiApi(username, password)
  File "D:\eksisozluk\venv\lib\site-packages\eksisozluk\EksiSozluk.py", line 61, in __init__
    self.auth()
  File "D\eksisozluk\venv\lib\site-packages\eksisozluk\EksiSozluk.py", line 92, in auth
    self.token = self.login(self.username, self.password)
  File "D\eksisozluk\venv\lib\site-packages\eksisozluk\EksiSozluk.py", line 133, in login
    return EksiToken.from_dict(response.json())
  File "D:\eksisozluk\venv\lib\site-packages\eksisozluk\Models\Auth\EksiToken.py", line 31, in from_dict
    rank = int(from_str(obj.get("rank")))
  File "D:\eksisozluk\venv\lib\site-packages\eksisozluk\Models\__init__.py", line 20, in from_str
    assert isinstance(x, str)
AssertionError

I get this whenever I try to initialize the API with a username and a password. Anonymous initialization works just fine.

yasinkaraaslan commented 2 years ago

ok, got it. You have to put your e-mail address in "username" parameter instead of your actual username.