My code is as follows:
import gdata.photos.service
import gdata.media
import gdata.geo
import atom

username = 'vallsdotname'
email = 'XXX'
password = 'XXX
source = 'vallsdotname-albumlist-1'
filename = 'C:/Users/Valls/Downloads/Desktops/
00660_splash_2560x1600.jpg'

pws = gdata.photos.service.PhotosService()
pws.ClientLogin(username, password)
albums = pws.GetUserFeed().entry
photos = pws.GetFeed(albums[0].GetPhotosUri()).entry
album = albums[0]
photo = pws.InsertPhotoSimple(album_url, 'New Photo', 'Uploaded using
the API', filename, content_type='image/jpeg')
photo = photos[8]
photo.rotation = gdata.photos.Rotation(text='90')
photo = pws.UpdatePhotoMetadata(photo)
# so far so good
ph = pws.UpdatePhotoBlob(photo, filename)
# errors
fh = open(filename, 'rb')
ph = pws.UpdatePhotoBlob(photo, fh)
# errors

And this is what I captured. Hopefully will be enough. Any advice on
http monitors?

Send: Return Code: 0x00000000
PUT
http://picasaweb.google.com/data/media/api/user/vallsdotname/albumid/5365689932489135537/photoid/5367284203201802034/31?authkey=Gv1sRgCLDEx9OSxMyCzgE
HTTP/1.1
Accept-Encoding: identity
Host: picasaweb.google.com
Content-Length: 176489
Content-Type: image/jpeg
Authorization: GoogleLogin
auth=DQAAAIwAAAAMe34fRcNb3L_9GuxNfNbdk2cfgk886rkmn1PZ9tGBcy1gPTuROvNgbgQi8eqfP_XY5K5WPmSbtw5SmOPm8huMK-
WQ4oAaRboug_bmtjzHz7JgqkyerDQSdpteFrsWK0CXJZpfpdBghMRT0gLkGMEMVaiSx9lsSMT7DADG8H3HyT7ehSJeW4oIdGiRxA-
Fcx4
User-Agent: None GData-Python/1.3.3

Send: Return Code: 0x00000000
00000000  FF D8 FF E0 00 10 4A 46 49 46 00 01 01 01 00
48    ......JFIF.....H
[...]

Receive: Return Code: 0x00000000
<?xml version='1.0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/
2005/Atom' xmlns:exif='http://schemas.google.com/photos/exif/2007'
xmlns:gphoto='http://schemas.google.com/photos/2007'
xmlns:media='http://search.yahoo.com/mrss/'><id>http://
picasaweb.google.com/data/entry/api/user/vallsdotname/albumid/
5365689932489135537/photoid/5367284203201802034</
id><published>2009-08-07T18:03:55.000Z</
published><updated>2009-08-08T15:17:16.503Z</updated><category
scheme='http://schemas.google.com/g/2005#kind' term='http://
schemas.google.com/photos/2007#photo'/><title type='text'>New Photo</
title><summary type='text'>Uploaded using the API</summary><content
type='image/jpeg' src='http://lh4.ggpht.com/_vgXOso7OdEA/Snxsi7RorzI/
AAAAAAAAB6k/j-KVLIK75LQ/New%20Photo.jpg'/><link rel='http://
schemas.google.com/g/2005#feed' type='application/atom+xml'
href='http://picasaweb.google.com/data/feed/api/user/vallsdotname/
albumid/5365689932489135537/photoid/5367284203201802034?
authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link rel='alternate' type='text/html'
href='http://picasaweb.google.com/vallsdotname/2009_07_29?
authkey=Gv1sRgCLDEx9OSxMyCzgE#5367284203201802034'/><link rel='http://
schemas.google.com/photos/2007#canonical' type='text/html'
href='http://picasaweb.google.com/lh/photo/BdP8LrkztXzpxc4vYnpPmg?
authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link rel='self' type='application/atom
+xml' href='http://picasaweb.google.com/data/entry/api/u
Receive: Return Code: 0x00000000
ser/vallsdotname/albumid/5365689932489135537/photoid/
5367284203201802034?authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link rel='edit'
type='application/atom+xml' href='http://picasaweb.google.com/data/
entry/api/user/vallsdotname/albumid/5365689932489135537/photoid/
5367284203201802034/32?authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link rel='edit-
media' type='image/jpeg' href='http://picasaweb.google.com/data/media/
api/user/vallsdotname/albumid/5365689932489135537/photoid/
5367284203201802034/32?authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link
rel='media-edit' type='image/jpeg' href='http://picasaweb.google.com/
data/media/api/user/vallsdotname/albumid/5365689932489135537/photoid/
5367284203201802034/32?authkey=Gv1sRgCLDEx9OSxMyCzgE'/><link
rel='http://schemas.google.com/photos/2007#report' type='text/html'
href='http://picasaweb.google.com/lh/reportAbuse?
uname=vallsdotname&amp;aid=5365689932489135537&amp;iid=5367284203201802034'/
><gphoto:id>5367284203201802034</gphoto:id><gphoto:version>32</
gphoto:version><gphoto:albumid>5365689932489135537</
gphoto:albumid><gphoto:access>private</
gphoto:access><gphoto:width>1200</gphoto:width><gphoto:height>1600</
gphoto:height><gphoto:size>117066</gphoto:size><gphoto:client/
><gphoto:checksum/><gphoto:timestamp>1249668235000</
gphoto:timestamp><gphoto:imageVersion>1961</
gphoto:imageVersion><gphoto:commentingEnabled>true</
gphoto:commentingEnabled><gphoto:commentCount>1</
gphoto:commentCount><exif:tags><exif:imageUniqueID>5e2680042d568e46fdcf7b2ee89f2a7b</
exif:imageUniqueID></exif:tags><media:group><media:content url='http://
lh4.ggpht.com/_vgXOso7OdEA/Snxsi7RorzI/AAAAAAAAB6k/j-KVLIK75LQ/New
%20Photo.jpg' height='1600' width='1200' type='image/jpeg'
medium='image'/><media:credit>josep.vallsva</
media:credit><media:description type='plain'>Uploaded using the API</
media:description><media:keywords/><media:thumbnail url='http://
lh4.ggpht.com/_vgXOso7OdEA/Snxsi7RorzI/AAAAAAAAB6k/j-KVLIK75LQ/s72/New
%20Photo.jpg' height='72' width='54'/><media:thumbnail url='http://
lh4.ggpht.com/_vgXOso7OdEA/Snxsi7RorzI/AAAAAAAAB6k/j-KVLIK75LQ/s144/New
%20Photo.jpg' height='144' width='108'/><media:thumbnail url='http://
lh4.ggpht.com/_vgXOso7OdEA/Snxsi7RorzI/AAAAAAAAB6k/j-KVLIK75LQ/s288/New
%20Photo.jpg' height='288' width='216'/><media:title type='plain'>New
Photo</media:title></media:group></entry>



Is there a bug somewhere that should be reported?
I guess I could work around it by generating my own request, in that
case, it'd be very helpful if you could direct me to some good
tutorials to start with this.


Thanks!

On Aug 8, 1:31 am, Detlev <[email protected]> wrote:
> This sounds like a version conflict issue. In GData v1, you had to
> specifiy the current versionid with the edit link. Requesting a photo
> entry would conveniently add it to the edit link element. In Gdata v2,
> we no longer support this type of optimistic concurrency. Instead
> you'll need to take the ETag from the last photo entry response and
> use it in the If-Match header for your next update request. You can
> also use a * for the If-Match header to effectively disable any
> version checking.
> I am not familiar at all with the Python client library, and am not
> sure if it even supports v2 already for the Picasa Web API.
> Can you log the entire HTTP requests and responses (with headers)?
> This should tell you if you're really sending a v2 GData request or
> not, and if the library is setting the headers correctly.
>
> On Aug 7, 4:16 pm, Josep Valls <[email protected]> wrote:
>
> > Hi,
>
> > I'd like to do some processing on the images I have posted on Picasa.
> > I will download them, process them and update the image data. I want
> > to keep all my albums and all the metadata the pictures already had
> > when I first uploaded them.
> > When I try to call UpdatePhotoBlob I get the following exception:
> > Traceback (most recent call last):
> >   File "..\7.py", line 31, in <module>
> >     ph = pws.UpdatePhotoBlob(photo, filename)
> >   File "c:\python25\Lib\site-packages\gdata\photos\service.py", line
> > 581, in Upd
> > atePhotoBlob
> >     raise GooglePhotosException(e.args[0])
> > gdata.photos.service.GooglePhotosException: (409, 'Conflict', "<?xml
> > version='1.
> > 0' encoding='UTF-8'?><entry xmlns='http://www.w3.org/2005/Atom'
> > xmlns:exif='http
> > ://schemas.google.com/photos/exif/2007' xmlns:gphoto='http://
> > schemas.google.com/
> > photos/2007' xmlns:media='http://search.yahoo.com/mrss/'><id>http://
> > picasaweb.go...
>
> > This trace is from gdata 2.0.0. Same exception with 2.0.1.
>
> > What am I doing wrong?
>
> > Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Picasa Web Albums API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Picasa-Data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to