joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
309 stars 50 forks source link

Search in README example is not working. #46

Closed jrmzlara closed 3 years ago

jrmzlara commented 3 years ago

Using python 3.5.2 and python3-discogs-client==2.3.10

Steps:

import discogs_client d = discogs_client.Client('ExampleApplication/0.1') d = discogs_client.Client('ExampleApplication/0.1', user_token="{USERKEY}") results = d.search('Stockholm By Night', type='release') results.pages

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/discogs_client/models.py", line 328, in pages self._load_pagination_info() File "/usr/local/lib/python3.5/dist-packages/discogs_client/models.py", line 289, in _load_pagination_info data = self.client._get(self._url_for_page(1)) File "/usr/local/lib/python3.5/dist-packages/discogs_client/client.py", line 113, in _get return self._request('GET', url) File "/usr/local/lib/python3.5/dist-packages/discogs_client/client.py", line 105, in _request body = json.loads(content) File "/usr/lib/python3.5/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

alifhughes commented 3 years ago

Hey @jrmzlara, thanks for reaching out. We do not support Python version 3.5.2 and I think this could be the source of the problem. I've tried these steps using Python version 3.7.10 and it worked fine, see below:

Python 3.7.10 (default, Mar  5 2021, 13:23:01) 
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import discogs_client
>>> d = discogs_client.Client("test", user_token="...")
>>> results = d.search('Stockholm By Night', type='release')
>>> results.pages
52
>>> 

Please could you use Python version 3.6 or above which we're supporting, and see if it works for you? Thanks!

alifhughes commented 3 years ago

@jrmzlara Closing this issue due to inactivity, please reopen with fresh information if it is still relavent. Thank you.