discogs / discogs_client

DEPRECATED - Official Python Client for the Discogs API
http://www.discogs.com/developers
Other
480 stars 132 forks source link

Unable to Retrieve Data using API #77

Closed coreybobco closed 7 years ago

coreybobco commented 7 years ago

I haven't been able to get this Python API working for either Python 2.7 or Python 3.5. There's a post on the DIscogs forums with more info as well ( https://www.discogs.com/forum/thread/733972?page=1 ), but here's the stack trace:

d = discogs_client.Client('ExampleApplication/0.1', user_token="fusHcGIlCGHeRcHyYreV") results = d.search('Stockholm By Night', type='release') print(results[0])

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 377, in _make_request httplib_response = conn.getresponse(buffering=True) TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen body=body, headers=headers) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 379, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/requests/adapters.py", line 376, in send timeout=timeout File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 610, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 247, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/lib/python3/dist-packages/six.py", line 685, in reraise raise value.with_traceback(tb) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 560, in urlopen body=body, headers=headers) File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 379, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without" requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.5/dist-packages/discogs_client/models.py", line 361, in getitem page = self.page(page_index) File "/usr/local/lib/python3.5/dist-packages/discogs_client/models.py", line 347, in page data = self.client._get(self._url_for_page(index)) File "/usr/local/lib/python3.5/dist-packages/discogs_client/client.py", line 123, in _get return self._request('GET', url) File "/usr/local/lib/python3.5/dist-packages/discogs_client/client.py", line 110, in _request content, status_code = self._fetcher.fetch(self, method, url, data=data, headers=headers) File "/usr/local/lib/python3.5/dist-packages/discogs_client/fetchers.py", line 63, in fetch data=data, headers=headers) File "/usr/lib/python3/dist-packages/requests/api.py", line 53, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 468, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3/dist-packages/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3/dist-packages/requests/adapters.py", line 426, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

rodneykeeling commented 7 years ago

Hi @coreybobco,

Try a more specific User-Agent string. I've just reproduced this issue using that same UA string, but when I try a less generic string, it works fine. This is covered in the General Information section of the API documentation: https://www.discogs.com/developers/#page:home,header:home-general-information

Thanks, Rodney