Exemplo n.º 1
0
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 27 14:10:53 2018

@author: User
"""

from imgurpython import ImgurClient
import pyimgur
client_id = '290c05b6ac55301'
client_secret = '3b06b845e9682b0a294b3d494a48d84d8155503b'
path = "C:\\Users\\User\\Desktop\\me.jpg"
client = ImgurClient(client_id, client_secret)
auth = client.get_auth_url('pin')

al = client.get_account_album_ids("happysorry")
client.upload_from_path(path, config=None, anon=True)
print(al)
             "If not specifying an album, a valid username must be provided!"
         )
         parser.print_help()
         quit()
     # Try to get a user's content from their albums
     album_count = client.get_account_album_count(args.username)
     # If no albums, try to download they images associated with their account
     if album_count == 0:
         get_by_images = input("This user has no albums. "\
                               "Would you like to try to get their content by their images? \n"\
                               "Type 'Y' for yes or anything else to quit:\n")
         if get_by_images == 'Y':
             get_user_content_by_images(args.username)
         quit()
     else:
         albums = client.get_account_album_ids(args.username)
         if len(albums) != album_count:
             print(
                 "Album count does not equal number of albums retrieved! Must implement paging!"
             )
         for album in albums:
             get_images_from_album(album)
             time.sleep(5)  # pause to keep from going over the rate limit
 else:
     # Download a single album
     get_images_from_album(args.album)
 if args.credits:
     for k, v in client.credits.items():
         print(k, v)
     print("UserReset in local time: " +
           time.strftime('%Y-%m-%d %H:%M:%S',