Skip to content

Commit c6d3bbf

Browse files
committed
update_album example
1 parent 5fe3f7e commit c6d3bbf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

examples/upload_album.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
from InstagramAPI import InstagramAPI
4+
5+
username,password= "",""
6+
"""
7+
## Uploading a timeline album (aka carousel aka sidecar).
8+
"""
9+
media = [ #Albums can contain between 2 and 10 photos/videos.
10+
{
11+
'type' : 'photo',
12+
'file' : '/path/to/your/photo.jpg', # Path to the photo file.
13+
'usertags' : [
14+
{ # Optional, lets you tag one or more users in a PHOTO.
15+
'position' : [0.5, 0.5],
16+
# WARNING: THE USER ID MUST BE VALID. INSTAGRAM WILL VERIFY IT
17+
# AND IF IT'S WRONG THEY WILL SAY "media configure error".
18+
'user_id' : '123456789', # Must be a numerical UserPK ID.
19+
},
20+
]
21+
},
22+
{
23+
'type' : 'photo',
24+
'file' : '/path/to/your/photo.jpg', # Path to the photo file.
25+
},
26+
#{
27+
# 'type' : 'video',
28+
# 'file' : '/path/to/your/video.mp4', # Path to the video file.
29+
# 'thumbnail': '/path/to/your/thumbnail.jpg'
30+
#}
31+
]
32+
captionText = 'caption 3'; # Caption to use for the album.
33+
ig = InstagramAPI(username,password)
34+
ig.login()
35+
ig.uploadAlbum(media, caption = captionText)

0 commit comments

Comments
 (0)