示例#1
0
def logon_to_picasaweb():
    gd_client = PhotosService()
    gd_client.email = USER
    gd_client.password = PASSWORD
    gd_client.source = 'kokorice.importer'
    gd_client.ProgrammaticLogin()
    return gd_client
示例#2
0
 def __init__(self, email, client_secret, credentials_dat):
     self._storage = Storage(credentials_dat)
     self._credentials = self._storage.get()
     if self._credentials is None or self._credentials.invalid:
         flow = flow_from_clientsecrets(client_secret,
                                        scope=PICASA_OAUTH_SCOPE,
                                        redirect_uri=PICASA_REDIRECT_URI)
         uri = flow.step1_get_authorize_url()
         print 'open to browser:'
         print uri
         code = raw_input('Enter the authentication code: ').strip()
         self._credentials = flow.step2_exchange(code)
     client = PhotosService()
     client.email = email
     client.source = 'inter-chat-bridge'
     self.client = client
     self.albums = {}
     self._refresh_auth_token()
示例#3
0
文件: picasa.py 项目: rayman18/wydev
__all__ = ['PicasaContainer']

from gdata.photos.service import PhotosService, GooglePhotosException
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.misc_utils import MetaSingleton
from pygui.item.containers import GenericContainer
from pygui.item.core import ActionItem
from pygui.item.mediaitem.core import ImageItem, MediaItem
from pygui.window import MessageWindow, LoadingWindow, KeyboardWindow
from pygui.facilities.picasa_config import PicasaConfig

log = GET_LOGGER(__name__)

# Init the Picasa Gdata client
PicasaGData = PhotosService()
PicasaGData.source = 'api-sample-google-com'


# Picasa Generic Album
# Provide access to Picasa album content
# Param:
#  username: Picassa user when looking for public albums or 'default' when looking for private albums
#  gphoto_id: album_id
class PicasaAlbumContainer(ImageItem, MediaItem, GenericContainer):
    def __init__(self, name, username, gphoto_id, parent=None, **kw):
        ImageItem.__init__(self, name, type_='image', **kw)
        MediaItem.__init__(self, name, type_='playlist', **kw)
        self.username = username
        self.gphoto_id = gphoto_id
        self.parent = parent
        self._content = None