prayagverma / gdata-python-client

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

Can't Create Picasa Album Using Auth Token #147

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I can create an album using the client login but can't seem to do this
using the auth sub token method. I have a valid session token and can
successfully query a feed but no can create album. Here's an
interactive example with debug = true:

>>> picasa_service.debug = 'true'
>>> picasa_service.GetUserFeed()

connect: (picasaweb.google.com, 80)
send: 'GET /data/feed/api/user/default?kind=album HTTP/1.1\r\nHost:
picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
GData-Python/1.1.1\r\nContent-Type: application/atom+xml\r
\nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Set-Cookie: _rtok=TFaILLrciTwV; Path=/

header: Set-Cookie: S=photos_html=fZMlNnpa3TB4-ciUxREnLw;
Domain=.google.com; Path=/

header: Content-Type: application/atom+xml; charset=UTF-8

header: Cache-Control: max-age=0, must-revalidate, no-transform

header: GData-Version: 1.0

header: Last-Modified: Wed, 16 Jul 2008 02:55:47 GMT

header: Transfer-Encoding: chunked

header: Date: Wed, 16 Jul 2008 02:55:47 GMT

header: Server: GFE/1.3

<gdata.photos.UserFeed object at 0x8824e6c>
...
...
--------- Please note that I've printed the content out successfully
but omitting to save space --------

>>> picasa_service.InsertAlbum('MyTitle','MySummary')

connect: (picasaweb.google.com, 80)
send: 'POST /data/feed/api/user/None HTTP/1.1\r\nHost:
picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
GData-Python/1.1.1\r\nContent-Length: 774\r\nContent-Type: application/
atom+xml\r\nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
send: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<ns0:entry
xmlns:ns0="http://www.w3.org/2005/Atom"><ns0:category scheme="http://
schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/
2007#album" /><ns1:group xmlns:ns1="http://search.yahoo.com/mrss/" /
><ns0:summary type="text">MySummary</ns0:summary><ns0:title

type="text">MyTitle</ns0:title><ns1:where xmlns:ns1="http://
www.georss.org/georss"><ns2:Point xmlns:ns2="http://www.opengis.net/
gml"><ns2:pos /></ns2:Point></ns1:where><ns1:timestamp
xmlns:ns1="http://schemas.google.com/photos/2007">1216177053210</
ns1:timestamp><ns1:commentingEnabled xmlns:ns1="http://
schemas.google.com/photos/2007">true</
ns1:commentingEnabled><ns1:access xmlns:ns1="http://schemas.google.com/
photos/2007">public</ns1:access></ns0:entry>'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Set-Cookie: _rtok=uFWIjI3vhRrw; Path=/

header: Set-Cookie: S=photos_html=DQKf0uNCvsvOzWvFEgGoLA;
Domain=.google.com; Path=/

header: Content-Type: text/html; charset=UTF-8

header: Transfer-Encoding: chunked

header: Date: Wed, 16 Jul 2008 02:56:29 GMT

header: Cache-control: private, must-revalidate, max-age=0

header: Server: GFE/1.3

header: Connection: Close

Traceback (most recent call last):
  File "<pyshell#72>", line 1, in <module>
    picasa_service.InsertAlbum('MyTitle','MySummary')
  File "/usr/lib/python2.5/site-packages/gdata/photos/service.py",
line 362, in InsertAlbum
    raise GooglePhotosException(e.args[0])
GooglePhotosException: (500, 'Internal Server Error', '')

Why is this? I've done this with Calendars and Contacts using auth sub
token with no problem - what's different??? Thanks.

    Reply    Reply to author    Forward       Rate this post: Text for
clearing space

You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

nicodotti2      
View profile
     More options Jul 15, 8:04 pm
From: nicodotti2 <nicodot...@gmail.com>
Date: Tue, 15 Jul 2008 20:04:52 -0700 (PDT)
Local: Tues, Jul 15 2008 8:04 pm
Subject: Re: Internal Server Error on Create Album
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
I should mention that the above picasa_service was instantiated with
auth token like:

>>> picasa_service = gdata.photos.service.PhotosService()
>>> picasa_service.auth_token = 'CMLLo-euHRDsXXXX' where XXXX is to
obfuscate my real token ;)

On Jul 15, 8:01 pm, nicodotti2 <nicodot...@gmail.com> wrote:

- Hide quoted text -
- Show quoted text -
> I can create an album using the client login but can't seem to do this
> using the auth sub token method. I have a valid session token and can
> successfully query a feed but no can create album. Here's an
> interactive example with debug = true:

> >>> picasa_service.debug = 'true'
> >>> picasa_service.GetUserFeed()

> connect: (picasaweb.google.com, 80)
> send: 'GET /data/feed/api/user/default?kind=album HTTP/1.1\r\nHost:
> picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
> GData-Python/1.1.1\r\nContent-Type: application/atom+xml\r
> \nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
> reply: 'HTTP/1.1 200 OK\r\n'
> header: Set-Cookie: _rtok=TFaILLrciTwV; Path=/

> header: Set-Cookie: S=photos_html=fZMlNnpa3TB4-ciUxREnLw;
> Domain=.google.com; Path=/

> header: Content-Type: application/atom+xml; charset=UTF-8

> header: Cache-Control: max-age=0, must-revalidate, no-transform

> header: GData-Version: 1.0

> header: Last-Modified: Wed, 16 Jul 2008 02:55:47 GMT

> header: Transfer-Encoding: chunked

> header: Date: Wed, 16 Jul 2008 02:55:47 GMT

> header: Server: GFE/1.3

> <gdata.photos.UserFeed object at 0x8824e6c>
> ...
> ...
> --------- Please note that I've printed the content out successfully
> but omitting to save space --------

> >>> picasa_service.InsertAlbum('MyTitle','MySummary')

> connect: (picasaweb.google.com, 80)
> send: 'POST /data/feed/api/user/None HTTP/1.1\r\nHost:
> picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
> GData-Python/1.1.1\r\nContent-Length: 774\r\nContent-Type: application/
> atom+xml\r\nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
> send: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<ns0:entry
> xmlns:ns0="http://www.w3.org/2005/Atom"><ns0:category scheme="http://
> schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/
> 2007#album" /><ns1:group xmlns:ns1="http://search.yahoo.com/mrss/"
/><ns0:summary type="text">MySummary</ns0:summary><ns0:title

> type="text">MyTitle</ns0:title><ns1:where
xmlns:ns1="http://www.georss.org/georss"><ns2:Point
xmlns:ns2="http://www.opengis.net/
> gml"><ns2:pos /></ns2:Point></ns1:where><ns1:timestamp
> xmlns:ns1="http://schemas.google.com/photos/2007">1216177053210</
> ns1:timestamp><ns1:commentingEnabled xmlns:ns1="http://
> schemas.google.com/photos/2007">true</
> ns1:commentingEnabled><ns1:access xmlns:ns1="http://schemas.google.com/
> photos/2007">public</ns1:access></ns0:entry>'
> reply: 'HTTP/1.1 500 Internal Server Error\r\n'
> header: Set-Cookie: _rtok=uFWIjI3vhRrw; Path=/

> header: Set-Cookie: S=photos_html=DQKf0uNCvsvOzWvFEgGoLA;
> Domain=.google.com; Path=/

> header: Content-Type: text/html; charset=UTF-8

> header: Transfer-Encoding: chunked

> header: Date: Wed, 16 Jul 2008 02:56:29 GMT

> header: Cache-control: private, must-revalidate, max-age=0

> header: Server: GFE/1.3

> header: Connection: Close

> Traceback (most recent call last):
>   File "<pyshell#72>", line 1, in <module>
>     picasa_service.InsertAlbum('MyTitle','MySummary')
>   File "/usr/lib/python2.5/site-packages/gdata/photos/service.py",
> line 362, in InsertAlbum
>     raise GooglePhotosException(e.args[0])
> GooglePhotosException: (500, 'Internal Server Error', '')

> Why is this? I've done this with Calendars and Contacts using auth sub
> token with no problem - what's different??? Thanks.

    Reply    Reply to author    Forward       Rate this post: Text for
clearing space

You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

nicodotti2      
View profile
     More options Jul 16, 8:07 am
From: nicodotti2 <nicodot...@gmail.com>
Date: Wed, 16 Jul 2008 08:07:25 -0700 (PDT)
Local: Wed, Jul 16 2008 8:07 am
Subject: Re: Internal Server Error on Create Album
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
Ok, I'm desperate! I really need to understand why this isn't working
using auth sub but does work using client login! I can also create
photos to already defined albums, query, etc.,etc., all using the same
photos service object with the auth sub token set, just not create
albums!!! Here's some more code PLEASE HELP!!!

photos_service = gdata.photos.service.PhotosService();
photos_service.ClientLogin('nicodot...@gmail.com',MYPASSWORD)
>>> entry = photos_service.InsertAlbum(title='New album', summary='This is
an album')
>>> photos_service2 = gdata.photos.service.PhotosService();
>>> photos_service2.auth_token = 'CMLLo-euHRDs9_RC' # ok so you know have
my auth token!!! I don't care just please help!!!
>>> entry = photos_service2.InsertAlbum(title='New album2', summary='This
is an album2')

Traceback (most recent call last):
  File "<pyshell#79>", line 1, in <module>
    entry = photos_service2.InsertAlbum(title='New album2',
summary='This is an album2')
  File "/usr/lib/python2.5/site-packages/gdata/photos/service.py",
line 362, in InsertAlbum
    raise GooglePhotosException(e.args[0])
GooglePhotosException: (500, 'Internal Server Error', '')

>>> photos_service2.debug = 'true'
>>> entry = photos_service2.InsertAlbum(title='New album2', summary='This
is an album2')

connect: (picasaweb.google.com, 80)
send: 'POST /data/feed/api/user/None HTTP/1.1\r\nHost:
picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
GData-Python/1.1.1\r\nContent-Length: 785\r\nContent-Type: application/
atom+xml\r\nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
send: '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<ns0:entry
xmlns:ns0="http://www.w3.org/2005/Atom"><ns0:category scheme="http://
schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/
2007#album" /><ns1:group xmlns:ns1="http://search.yahoo.com/mrss/" /
><ns0:summary type="text">This is an album2</ns0:summary><ns0:title

type="text">New album2</ns0:title><ns1:where xmlns:ns1="http://
www.georss.org/georss"><ns2:Point xmlns:ns2="http://www.opengis.net/
gml"><ns2:pos /></ns2:Point></ns1:where><ns1:timestamp
xmlns:ns1="http://schemas.google.com/photos/2007">1216220521020</
ns1:timestamp><ns1:commentingEnabled xmlns:ns1="http://
schemas.google.com/photos/2007">true</
ns1:commentingEnabled><ns1:access xmlns:ns1="http://schemas.google.com/
photos/2007">public</ns1:access></ns0:entry>'
reply: 'HTTP/1.1 500 Internal Server Error\r\n'
header: Set-Cookie: _rtok=uSqKC-ZscwMA; Path=/

header: Set-Cookie: S=photos_html=4PHrgrb-lsF-KxnC0tAHJg;
Domain=.google.com; Path=/

header: Content-Type: text/html; charset=UTF-8

header: Transfer-Encoding: chunked

header: Date: Wed, 16 Jul 2008 15:00:54 GMT

header: Cache-control: private, must-revalidate, max-age=0

header: Server: GFE/1.3

header: Connection: Close

Traceback (most recent call last):
  File "<pyshell#82>", line 1, in <module>
    entry = photos_service2.InsertAlbum(title='New album2',
summary='This is an album2')
  File "/usr/lib/python2.5/site-packages/gdata/photos/service.py",
line 362, in InsertAlbum
    raise GooglePhotosException(e.args[0])
GooglePhotosException: (500, 'Internal Server Error', '')

But now watch, I can get a feed (actually I can also create photos,
etc.,etc, but for proof purposes this should suffice):
>>> feed = photos_service2.GetUserFeed()

connect: (picasaweb.google.com, 80)
send: 'GET /data/feed/api/user/default?kind=album HTTP/1.1\r\nHost:
picasaweb.google.com\r\nAccept-Encoding: identity\r\nUser-Agent: None
GData-Python/1.1.1\r\nContent-Type: application/atom+xml\r
\nAuthorization: AuthSub token=CMLLo-euHRDs9_RC\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Set-Cookie: _rtok=tJ6b-QNnHXM3; Path=/

header: Set-Cookie: S=photos_html=-s44l3vGAIbhsTCcLc1jqA;
Domain=.google.com; Path=/

header: Content-Type: application/atom+xml; charset=UTF-8

header: Cache-Control: max-age=0, must-revalidate, no-transform

header: GData-Version: 1.0

header: Last-Modified: Wed, 16 Jul 2008 15:01:43 GMT

header: Transfer-Encoding: chunked

header: Date: Wed, 16 Jul 2008 15:01:43 GMT

header: Server: GFE/1.3

>>> print feed

<?xml version='1.0' encoding='UTF-8'?>
<ns0:feed xmlns:ns0="http://www.w3.org/2005/Atom"><ns1:quotacurrent
xmlns:ns1="http://schemas.google.com/photos/2007">316279</
ns1:quotacurrent><ns1:user xmlns:ns1="http://schemas.google.com/photos/
2007">nicodotti2</ns1:user><ns1:nickname xmlns:ns1="http://
schemas.google.com/photos/2007">nicodotti</ns1:nickname><ns0:category
scheme="http://schemas.google.com/g/2005#kind" term="http://
schemas.google.com/photos/2007#user" /><ns0:id>http://
picasaweb.google.com/data/feed/api/user/default</ns0:id><ns0:generator
uri="http://picasaweb.google.com/" version="1.00">Picasaweb</
ns0:generator><ns1:startIndex xmlns:ns1="http://a9.com/-/spec/
opensearchrss/1.0/">1</ns1:startIndex><ns1:maxPhotosPerAlbum
xmlns:ns1="http://schemas.google.com/photos/2007">500</
ns1:maxPhotosPerAlbum><ns0:icon>http://lh3.ggpht.com/nicodotti2/
AAAA6uzo5cI/AAAAAAAAAAA/ooMrvSCqDi8/s64-c/nicodotti2.jpg</
ns0:icon><ns1:quotalimit xmlns:ns1="http://schemas.google.com/photos/
2007">1073741824</ns1:quotalimit><ns0:subtitle type="text" /
><ns1:thumbnail xmlns:ns1="http://schemas.google.com/photos/

2007">http://lh3.ggpht.com/nicodotti2/AAAA6uzo5cI/AAAAAAAAAAA/
ooMrvSCqDi8/s64-c/nicodotti2.jpg</
ns1:thumbnail><ns0:author><ns0:name>nicodotti</
ns0:name><ns0:uri>http://picasaweb.google.com/nicodotti2</ns0:uri></
ns0:author><ns0:link href="http://picasaweb.google.com/data/feed/api/
user/nicodotti2" rel="http://schemas.google.com/g/2005#feed"
type="application/atom+xml" /><ns0:link href="http://
picasaweb.google.com/data/feed/api/user/nicodotti2" rel="http://
schemas.google.com/g/2005#post" type="application/atom+xml" /
><ns0:link href="http://picasaweb.google.com/nicodotti2"

rel="alternate" type="text/html" /><ns0:link href="http://
picasaweb.google.com/s/c/bin/slideshow.swf?
host=picasaweb.google.com&amp;RGB=0x000000&amp;feed=http%3A%2F
%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fnicodotti2%3Falt
%3Drss" rel="http://schemas.google.com/photos/2007#slideshow"
type="application/x-shockwave-flash" /><ns0:link href="http://
picasaweb.google.com/data/feed/api/user/nicodotti2?start-
index=1&amp;max-results=1000&amp;kind=album" rel="self"
type="application/atom+xml" /><ns0:updated>2008-07-16T15:01:43.265Z</
ns0:updated><ns1:totalResults xmlns:ns1="http://a9.com/-/spec/
opensearchrss/1.0/">3</ns1:totalResults><ns1:itemsPerPage
xmlns:ns1="http://a9.com/-/spec/opensearchrss/1.0/">1000</
ns1:itemsPerPage><ns0:title type="text">nicodotti2</ns0:title></
ns0:feed> 

Original issue reported on code.google.com by roblevin...@gmail.com on 22 Jul 2008 at 5:10

GoogleCodeExporter commented 9 years ago
I think this is similar to issue 184

you can set self.email = 'default' before InsertAlbum

Original comment by kernel1...@gmail.com on 7 Nov 2008 at 6:42

GoogleCodeExporter commented 9 years ago
hope can support

Original comment by lini....@gmail.com on 16 Oct 2009 at 7:39

GoogleCodeExporter commented 9 years ago

Original comment by afs...@google.com on 7 Oct 2011 at 12:17