carolinux / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
0 stars 1 forks source link

'OAuthToken' object has no attribute 'modify_request' #473

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
(code oversimplified for clarity)
1. set oauth_token = gdata.auth.OAuthToken(key=TOKEN, secret=TOKEN_SECRET)
2. call client.GetDoc(docID, auth_token = oauth_token)

What is the expected output? What do you see instead?
I expect to get a reference to the doc, but I see an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/gdata/docs/client.py", line 176, in get_doc
    auth_token=auth_token, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/gdata/client.py", line 647, in get_entry
    desired_class=desired_class, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/gdata/client.py", line 265, in request
    uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/atom/client.py", line 108, in request
    auth_token.modify_request(http_request)
AttributeError: 'OAuthToken' object has no attribute 'modify_request'

What version of the product are you using?
gdata 2.0.13 + python 2.6

Please provide any additional information below.

I think the problem is:

http://gdata-python-client.googlecode.com/svn/trunk/src/atom/client.py
    # Add the Authorization header at the very end. The Authorization header
    # value may need to be calculated using information in the request.
    if auth_token:
      auth_token.modify_request(http_request)

and the existing OAuthToken has no modify_request, but it does have a 
perform_request

  def perform_request(self, http_client, operation, url, data=None,

as well as GenericToken:

  http://gdata-python-client.googlecode.com/svn/trunk/src/atom/http_interface.py

So the API seems to be broken for this, since I can't make any requests :'(

Original issue reported on code.google.com by evn@google.com on 6 Dec 2010 at 11:44

GoogleCodeExporter commented 9 years ago
Woops!

Fixed by using gdata.gauth instead of gdata.auth

oauth_token = gdata.gauth.OAuthHmacToken(CONSUMER_KEY, CONSUMER_SECRET, TOKEN, 
TOKEN_SECRET, gdata.gauth.ACCESS_TOKEN) 

That fixed the problem

Original comment by evn@google.com on 6 Dec 2010 at 11:52

GoogleCodeExporter commented 9 years ago
Glad it works!

Original comment by vicfry...@google.com on 7 Dec 2010 at 1:02