Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting KeyError: 'gender' since this morning... #146

Closed
VikasRana opened this issue Jul 5, 2023 · 2 comments
Closed

getting KeyError: 'gender' since this morning... #146

VikasRana opened this issue Jul 5, 2023 · 2 comments

Comments

@VikasRana
Copy link

File "C:\Python39\lib\site-packages\tidalapi\session.py", line 323, in login_oauth_simple
   future.result()
 File "C:\Python39\lib\concurrent\futures\_base.py", line 445, in result
   return self.__get_result()
 File "C:\Python39\lib\concurrent\futures\_base.py", line 390, in __get_result
   raise self._exception
 File "C:\Python39\lib\concurrent\futures\thread.py", line 52, in run
   result = self.fn(*self.args, **self.kwargs)
 File "C:\Python39\lib\site-packages\tidalapi\session.py", line 364, in _process_link_login
   self.user = tidalapi.User(self, user_id=json['userId']).factory()
 File "C:\Python39\lib\site-packages\tidalapi\user.py", line 49, in factory
   return self.request.map_request("users/%s" % self.id, parse=self.parse)
 File "C:\Python39\lib\site-packages\tidalapi\request.py", line 118, in map_request
   return self.map_json(json_obj, parse=parse)
 File "C:\Python39\lib\site-packages\tidalapi\request.py", line 125, in map_json
   return parse(json_obj)
 File "C:\Python39\lib\site-packages\tidalapi\user.py", line 65, in parse
   return user.parse(json_obj)
 File "C:\Python39\lib\site-packages\tidalapi\user.py", line 114, in parse
   self.gender = json_obj["gender"]
KeyError: 'gender'
@tehkillerbee
Copy link
Collaborator

tehkillerbee commented Jul 5, 2023

Thanks for the heads-up.

This is a similar issue to
tehkillerbee/mopidy-tidal#97

Take a look at the line here:
https://github.com/tamland/python-tidal/blob/5207a3cff2af437a2d0d67b743c875a67f8d1d08/tidalapi/user.py#L114C9-L114C9

Change

self.gender = json_obj["gender"]

to

self.gender = json_obj.get("gender", None)

@VikasRana
Copy link
Author

Thanks, Will look it up.

mkaufhol added a commit to mkaufhol/python-tidal that referenced this issue Jul 5, 2023
BlackLight added a commit that referenced this issue Jul 6, 2023
#146: Fixed key error for gender when parsing user json
NickCao pushed a commit to NixOS/nixpkgs that referenced this issue Jul 18, 2023
This release fixes a critical bug; version 0.7.1 has not worked with the
current version of the Tidal API for a couple weeks:
tamland/python-tidal#146

0.7.2 also changes the packaging method from setuptools to pyproject.
github-actions bot pushed a commit to NixOS/nixpkgs that referenced this issue Jul 18, 2023
This release fixes a critical bug; version 0.7.1 has not worked with the
current version of the Tidal API for a couple weeks:
tamland/python-tidal#146

0.7.2 also changes the packaging method from setuptools to pyproject.

(cherry picked from commit b673a2e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants