moneyapi / google-api-python-client

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

GAE-1.7.7's oauth2client/appengine.py:_create_flow(self, request_handler) returns AttributeError: 'Resource' object has no attribute 'request' #264

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
I have an OAuth2 decorator:
    decorator = OAuth2DecoratorFromClientSecrets(CLIENT_SECRETS, YOUTUBE_READ_WRITE_SCOPE)

... and I sometimes call a function that requires authentication:
    playlist_id = youtube_create_playlist(youtube)

... so I prepend it with decorator:
    @decorator.oauth_required
    def youtube_create_playlist(youtube):
      playlists_insert_response = youtube.playlists().insert(
      ...

→ As expected, when stepping into youtube_create_playlist(), I go through 
oauth2client/appengine.py:oauth_required(), then check_oauth(), then 
_create_flow(), where at line 674 of appengine.py 1.7.7 we have:

    redirect_uri = request_handler.request.relative_url(
              self._callback_path) # Usually /oauth2callback

What is the expected output? What do you see instead?
- Expected: getting a redirect_uri
- Instead: GAE throws exception AttributeError: 'Resource' object has no 
attribute 'request'. And indeed I can see in my Variables debugging pane that 
the request_handler object has no attribute 'request'. Am I doing something 
wrong? Is it a bug?

What version of the product are you using? On what operating system?
- GAE 1.7.7
- Python 2.7.4
- Ubuntu 13.04 x64

Please provide any additional information below.
- I'm new to both GAE and python, sorry if the problem lies between my chair 
and my keyboard. Please point me things I'm doing awfully wrong.
- Related StackOverflow post: 
http://stackoverflow.com/questions/16309873/gae-1-7-7s-oauth2client-appengine-py
-create-flowself-request-handler-return

Original issue reported on code.google.com by ronan.jo...@gmail.com on 30 Apr 2013 at 10:30

GoogleCodeExporter commented 8 years ago
Problem due to incorrect usage of the decorator, as pointed by Tim Hoffman on 
StackOverflow. Sorry, please close the bug.

Original comment by ronan.jo...@gmail.com on 1 May 2013 at 8:40