2
我正嘗試使用imgurpython創建相冊並將圖像上傳到其中。但是,我無法將圖像附加到相冊中。它給了我以下錯誤:(403) The album you're requesting does not belong to your account
。以下是我的代碼:無法在創建的相冊中上傳圖像:Imgur python
client = ImgurClient(client_id, client_secret)
def CreateAlbumAndUploadImages(albumName,albumDescription,images):
fields = {}
fields['title'] = albumName
fields['description'] = albumDescription
fields['privacy'] = 'public'
x = client.create_album(fields)
print(x)
y = client.album_add_images(x['id'],images) #error here
print(y)
return x
def UploadPhoto(images):
config = {
'name': 'some image name here',
'title': 'some title here',
'description': 'some description here'}
image = client.upload_from_path(image_path, config=config, anon=False)
print("Done")
print(image)
return image
def main():
#x = CreateAlbum('Album 101','Album 101 desciption')
id = []
id.append(UploadPhoto(['image1.jpg'])['id'])
id.append(UploadPhoto(['image2.jpg'])['id'])
x = CreateAlbumAndUploadImages('albumNameHere','some description here',id)
pass
if __name__ == '__main__':
main()
注:我想建立一個機器人,因此呼籲授權的網站是不是一種選擇