Hi,
I've seen your code and I decided to try it.
I keep getting this error:
File
"/base/data/home/apps/s~art-everywhere/5.384631426060744536/oauth_buddy.py",
line 9, in generate_client
gdata_auth(client, client_id, client_secret,
'https://picasaweb.google.com/data/', useragent)
File
"/base/data/home/apps/s~art-everywhere/5.384631426060744536/oauth_buddy.py",
line 57, in gdata_auth
code = raw_input('code:')
EOFError: EOF when reading a line
The code it's the same... have you got any idea about? What am I doing
wrong?
And another little thing... It matters what i write on useragent? Because I
really don't know what to write there...
Thanks in advance!
Il giorno sabato 28 giugno 2014 11:47:59 UTC+2, [email protected] ha scritto:
>
> sample:
>
> def main():
> gdata_monkey_patch()
>
> from gdata.photos.service import PhotosService
> client = PhotosService()
> client_id = 'xxx'
> client_secret = 'xxx'
> useragent = 'xxx'
> gdata_auth(client, client_id, client_secret, '
> https://picasaweb.google.com/data/', useragent)
>
> username = 'xxx'
> print client.GetUserFeed(user=username)
>
>
> def gdata_monkey_patch():
> def _authorize(self, client):
> client.auth_token = self
> request_orig = client.http_client.request
>
> #def new_request(http_request):
> def new_request(*args, **kwd):
> #response = request_orig(http_request)
> response = request_orig(*args, **kwd)
> if response.status == 401:
> refresh_response = self._refresh(request_orig)
> if self._invalid:
> return refresh_response
> else:
> #self.modify_request(*args, **kwd)
> self.modify_request(*args, **kwd)
> #return request_orig(*args, **kwd)
> return request_orig(*args, **kwd)
> else:
> return response
>
> client.http_client.request = new_request
> return client
>
> from gdata import gauth
> gauth.OAuth2Token.authorize = _authorize
>
>
> def gdata_auth(client, client_id, client_secret, scope, useragent):
> from os.path import exists
> token_path = __file__ + '.gdata.token'
> if not exists(token_path):
> from gdata.gauth import OAuth2Token
> token = OAuth2Token(
> client_id=client_id,
> client_secret=client_secret,
> scope=scope,
> user_agent=useragent)
>
> url =
> token.generate_authorize_url(redirect_uri='urn:ietf:wg:oauth:2.0:oob')
>
> from webbrowser import open as webopen
> webopen(url)
>
> code = raw_input('code:')
> token.get_access_token(code)
>
> with file(token_path, 'w') as writable:
> from gdata.gauth import token_to_blob
> writable.write(token_to_blob(token).encode('UTF-8'))
> else:
> with file(token_path) as readable:
> from gdata.gauth import token_from_blob
> token = token_from_blob(unicode(readable.read(), 'UTF-8'))
>
> token.authorize(client)
>
> main()
>
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-picasa-data-api.
For more options, visit https://groups.google.com/d/optout.