discogs / discogs_client

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

requests.get has wrong parameters #3

Closed matigit closed 13 years ago

matigit commented 13 years ago

With the current git clone (but I think this was also present with the version coming from pypi) I get the following traceback:

>>> r = discogs.Release( 934425 )
>>> t = r.tracklist[9]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/discogs_client-1.1.0-py2.7.egg/discogs_client.py", line 165, in tracklist
    for track in self.data.get('tracklist', []):
  File "/usr/local/lib/python2.7/dist-packages/discogs_client-1.1.0-py2.7.egg/discogs_client.py", line 52, in data
    if self._response.content and self._response.status_code == 200:
  File "/usr/local/lib/python2.7/dist-packages/discogs_client-1.1.0-py2.7.egg/discogs_client.py", line 38, in _response
    self._cached_response = requests.get(self._uri, self._params, self._headers)
TypeError: get() takes exactly 1 argument (3 given)

during the install (python setup.py install) it installed version 0.6.1 of the python-requests library.

I was doing a fork but right now git push doesn't seem to be working, so here is just the trivial patch as plain text:

diff --git a/discogs_client.py b/discogs_client.py
index f52d769..ee2e48d 100644
--- a/discogs_client.py
+++ b/discogs_client.py
@@ -35,7 +35,7 @@ class APIBase(object):
         if not self._cached_response:
             if not self._check_user_agent():
                 raise DiscogsAPIError, 'Invalid or no User-Agent set'
-            self._cached_response = requests.get(self._uri, self._params, self._headers)
+            self._cached_response = requests.get(self._uri, params=self._params, headers=self._headers)

         return self._cached_response

vreon commented 13 years ago

Huh, strange. I thought requests might have changed their API in 0.6, but that doesn't seem to be the case.

Thanks for the patch!

evz commented 13 years ago

Hate to be "that guy" but I'm still getting the error (exact same stack trace) despite the patch

colinmarc commented 13 years ago

I was getting this (I downloaded pre-patch) until I wiped it out, cloned the repo again and installed from that.

vreon commented 13 years ago

@evz, can you pull from this repo again (to pick up @colinmarc's patch for #4) and try pip install -U requests?

evz commented 13 years ago

Just so you know I'm listening, I'll be working on this again over the weekend and will try it out then.

evz commented 13 years ago

Seems to be working for me now. Thanks for the follow up!

moviewang commented 6 years ago

pip install -U requests works out thks a log