2010-11-21 4 views
1

Je voudrais déplacer un grand nombre de photos en picassa. Je n'ai aucun problème à télécharger en utilisant InsertPhotoSimple, mais je veux aussi télécharger des métadonnées et j'ai des problèmes avec InsertPhoto. Quelqu'un peut-il me diriger vers un exemple simple ou me dire ce que je fais mal?Exemple simple pour télécharger des photos dans google picasa

Voici ce que j'ai maintenant:

#!/bin/python 

import gdata.photos.service 
import gdata.media 

gd_client = gdata.photos.service.PhotosService() 
gd_client.email = 'my_google_email' 
gd_client.password = 'my_pass' 
gd_client.source = 'my_source' 
gd_client.ProgrammaticLogin() 

album_url = '/data/feed/api/user/%s/albumid/%s' % ('default', 'default') 
filename = 'myfile.jpg' 
metadata = gdata.photos.PhotoEntry() 
metadata.title = 'My Photo Title' 
metadata.media.keywords = 'keyword1, keyword2, keyword3' 

upload_photo = gd_client.InsertPhoto(album_url, metadata, filename, content_type='image/jpeg') 

Mais quand je lance cela, il CHOKES chaque fois avec: retraçage (appel le plus récent en dernier): Fichier « ./picassa.py », ligne 36, dans? upload_photo = gd_client.InsertPhoto (album_url, métadonnées, nom de fichier, type_de_vidéo = 'image/jpeg') Fichier "/home1/alptownc/public_html/photos/gdata-2.0.13/gdata/photos/service.py", ligne 425 , dans InsertPhoto converter = gdata.photos.PhotoEntryFromString) Fichier "/home1/alptownc/public_html/photos/gdata-2.0.13/gdata/service.py", ligne 1236, dans le poste media_source = media_source, converter = converter Fichier "/home1/alptownc/public_html/photos/gdata-2.0.13/gdata/service.py", ligne 1286, dans PostOrPut data_str = str (données) Fichier "/ home1/alptownc/public_html/photos/gdata-2.0.13/atom/init .py ", ligne 377, en str Fichier self.ToString de retour() "/home1/alptownc/public_html/photos/gdata-2.0.13/atom/ initialisation .py", ligne 374, dans ToString retour ElementTree.tostring (self._ToElementTree() , encoding = string_encoding) fichier "/home1/alptownc/public_html/photos/gdata-2.0.13/atom/ initialisation .py", ligne 369, dans _ToElementTree self._AddMembersToElementTree (new_tree)

Je sais Il me manque quelque chose de stupide et de simple, mais je ne vois pas ce que c'est. Merci

Répondre

0

Je pense que vous devez utiliser insertPhotoEntry au lieu de seulement insertPhoto?

Questions connexes