Beispiel #1
0
def main():
    smugmug_api_key = "29qIYnAB9zHcIhmrqhZ7yK7sPsdfoV0e"  # API key

    sapi = SI.SmugMugAPI(smugmug_api_key)
    parser = init_parser()
    (options, args) = parser.parse_args()
    if options.debug:
        SI.set_log_level(logging.DEBUG)

    session_id = user_login(sapi, options.email, options.password)
    #session_id = anon_login (sapi) # add command line option to support anon logins

    if options.mode == "random_image":
        print get_random_image(sapi, session_id)
    elif options.mode == "pop_album":
        print get_most_pop_album(sapi, session_id)
    elif options.mode == "download_album_tiny":
        print download_album(sapi, session_id, options.album_id,
                             options.output)
    elif options.mode == "get_albums":
        print get_albums(sapi, session_id, options.nick)
    elif options.mode == "upload_image":
        print upload_image(sapi, session_id, options.album_id,
                           options.file_name)
    elif options.mode == "rotate_image_45":
        print rotate_image_45(sapi, session_id, options.image_id)
    elif options.mode == "find_image":
        print get_image(sapi, session_id, options.image_id)
    elif options.mode == "album_details":
        print get_album_details(sapi, session_id, options.album_id)

    return
def main ():
    smugmug_api_key = "29qIYnAB9zHcIhmrqhZ7yK7sPsdfoV0e"  # API key

    sapi = SI.SmugMugAPI (smugmug_api_key)
    parser = init_parser()
    (options, args) = parser.parse_args()
    if options.debug:
        SI.set_log_level(logging.DEBUG)

    session_id = user_login (sapi, options.email, options.password)
    #session_id = anon_login (sapi) # add command line option to support anon logins

    if options.mode == "random_image": 
        print get_random_image(sapi, session_id)
    elif options.mode == "pop_album": 
        print get_most_pop_album(sapi, session_id)
    elif options.mode == "download_album_tiny": 
        print download_album(sapi, session_id, options.album_id, options.output)
    elif options.mode == "get_albums": 
        print get_albums(sapi, session_id, options.nick)
    elif options.mode == "upload_image": 
        print upload_image(sapi, session_id, options.album_id, options.file_name)
    elif options.mode == "rotate_image_45": 
        print rotate_image_45(sapi, session_id, options.image_id)
    elif options.mode == "find_image": 
        print get_image (sapi, session_id, options.image_id)
    elif options.mode == "album_details": 
        print get_album_details (sapi, session_id, options.album_id)

    return
Beispiel #3
0
 def __init__ (self, api, email=None, password=None, fail_on_error = True):
     if email is not None and password is not None:
         result = api.login_withPassword (EmailAddress = email, Password = password)
     else:
         result = api.login_anonymously ()
     
     self.api = api
     self.id = result.Login[0].Session[0]["id"]
     SI.set_log_level(logging.DEBUG)
     return
Beispiel #4
0
    def __init__(self, api, email=None, password=None, fail_on_error=True):
        if email is not None and password is not None:
            result = api.login_withPassword(EmailAddress=email,
                                            Password=password)
        else:
            result = api.login_anonymously()

        self.api = api
        self.id = result.Login[0].Session[0]["id"]
        SI.set_log_level(logging.DEBUG)
        return