On Mar 22, 4:10 pm, notcourage <klr...@gmail.com> wrote:
> Did you ever find the solution?
>
> Is photo.media.thumbnail[1].url the URL for the actual image? Or a
> page containing it?

Great question, it would help if we could see URL being requested. The
reason I most often see for not being able to retrieve an image is
that the imgmax parameter is not being included.

http://code.google.com/apis/picasaweb/faq.html#embed_image

>
> I don't understand how to upload an image to picasa since
> gd_client.InsertPhotoSimple requires a filename and an appengine app
> doesn't have access to the file system, does it?

Good point. You could use the lower-level Post method found in
gdata.service.GDataService along with a gdata.MediaSource object to
simulate a file. This might look something like:

media_source = gdata.MediaSource(
    file_handle=StringIO.StringIO(your_image_data),
    content_type='image/jpeg',
    content_length=len(your_image_data),
    file_name='example.jpg')

Then look at the implementation for InsertPhoto(Simple) for ideas on
how to use the client.Post method.

Thank you,

Jeff

>
> Thx.
>
> On Feb 26, 3:32 am, "G. Nyman" <teh...@gmail.com> wrote:
>
> > Hello everybody,
>
> > I have been banging my head against this problem for a while now and I
> > can't seem to understand why it does what it does.
>
> > I am trying to import pictures fromPicasausing the code appended at
> > the end of this post. It works fine in the dev environment but for
> > some reasonpicasareturns 404 when i try to run it online.
>
> > The devserver-logs say:
> > INFO     2009-02-26 10:24:35,093 svgae.py] Got the following 
> > url:http://lh6.ggpht.com/_mUcXljy1w9g/SaQ-uXbkY4I/AAAAAAAAACE/DJtdqCz6u50...,
> > data was truncated? 0
> > INFO     2009-02-26 10:24:35,093 svgae.py] Big thumb got status 200
> > and lenght: 99720
> > INFO     2009-02-26 10:24:35,108 dev_appserver.py] "GET /
> > no_go_with_picasa HTTP/1.1" 200 -
>
> > The real thing says:
> > 02-26 02:25AM 24.551 /no_go_with_picasa 200 927ms 951ms-cpu 0kb
> > 130.232.90.98 - - [26/Feb/2009:02:25:25 -0800] "GET /no_go_with_picasa
> > HTTP/1.1" 200 104 - -
> > I 02-26 02:25AM 25.473
> > Got the following 
> > url:http://lh6.ggpht.com/_mUcXljy1w9g/SaQ-uXbkY4I/AAAAAAAAACE/DJtdqCz6u50...,
> > data was truncated? 0
> > I 02-26 02:25AM 25.474
> > Big thumb got status 404 and lenght: 1421
>
> > This might be apicasaproblem but I tought I'll try here first. The
> > url to the photo works in both cases so I don't understand the 404.
> > The most interesting thing is that urlfetch on photo.media.thumbnail
> > [0].url works fine.
>
> > Thankfull for all assistance
>
> > /G. Nyman
>
> > Code to replicate the problem:
> > ---------------------------
> > class PicasaProblem(webapp.RequestHandler):
> >         def get(self):
> >                 gd_client = gdata.photos.service.PhotosService()
> >                 gdata.alt.appengine.run_on_appengine(gd_client)
> >                 username = 'tehviu'
> >                 albumid = 'SigmaTest'
> >                 photos = gd_client.GetFeed(
> >                     '/data/feed/api/user/%s/album/%s?
> > kind=photo&thumbsize=64,1024&imgmax=d' % (
> >                         username, albumid))
> >                 for photo in photos.entry:
> >                         img_thumb_big = None
> >                         try:
> >                                 img_thumb_big = 
> > urlfetch.fetch(photo.media.thumbnail[1].url)
> >                         except Exception, e:
> >                                 logging.exception(e)
> >                                 error = 'Image importing error'
>
> >                         logging.info("Got the following url: " + 
> > photo.media.thumbnail
> > [1].url + ", data was truncated? " + str
> > (img_thumb_big.content_was_truncated))
> >                         logging.info("Big thumb got status "+ str
> > (img_thumb_big.status_code) + " and lenght: " + img_thumb_big.headers
> > ['content-length'])
> >                         break
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to