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

Python 3 fixes #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Python 3 fixes #4

wants to merge 2 commits into from

Conversation

ssssam
Copy link

@ssssam ssssam commented Sep 3, 2018

Hi!
This branch fixes a couple of exceptions that I encountered when using lastfmclient with Python3.

I did a brief test using Python2 after my changes. I authenticated and called the user.get_top_artists() method, which worked as expected.

In Python 2, dict.keys() returned a list but in Python 3 it returns
an opaque iterable type that doesn't directly support indexing.

Fixes this sort of error:

    Traceback (most recent call last):
      ..
      File "/home/sam/.local/lib/python3.6/site-packages/lastfmclient/package.py", line 9, in _call
        return self._client.call(http_method, method, auth, params)
      File "/home/sam/.local/lib/python3.6/site-packages/lastfmclient/client.py", line 76, in call
        return self._process_response_data(data)
      File "/home/sam/.local/lib/python3.6/site-packages/lastfmclient/client.py", line 131, in _process_response_data
        return data[keys[0]]
    TypeError: 'dict_keys' object does not support indexing
This type doesn't exist in Python 3.
@ssssam
Copy link
Author

ssssam commented Sep 3, 2018

I just spotted https://github.com/jakubroztocil/lastfmclient/pull/1/files which contains the same fixes, plus a lot more stuff. I haven't tested that myself yet.

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

Successfully merging this pull request may close these issues.

None yet

1 participant