You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+131-8Lines changed: 131 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,26 +18,149 @@ Discussion
18
18
Visit [our Google Group](http://groups.google.com/group/instagram-api-developers) to discuss the Instagram API.
19
19
20
20
21
-
Obtaining an access token
21
+
Authentication
22
22
-----
23
-
You can use the provided get_access_token.py script to obtain an access token for yourself.
24
-
It will prompt you for your app's Client ID, Client Secret, and Redirect URI,
25
-
and walk you through instructions for getting your own access token for your app.
26
23
27
-
Usage
28
-
-----
24
+
Instagram API uses the OAuth2 protocol for authentication, but not all functionality requires authentication.
25
+
See the docs for more information: http://instagr.am/developer/auth/
26
+
27
+
### Obtaining an access token
28
+
29
+
If you're using a method that requires authentication and need an access token, you can use the provided get_access_token.py script to obtain an access token for yourself.
30
+
It will prompt you for your app's Client ID, Client Secret, and Redirect URI, and walk you through instructions for getting your own access token for your app.
31
+
32
+
### Authenticating a user
33
+
34
+
The provided sample app shows a simple OAuth flow for authenticating a user and getting an access token for them.
35
+
36
+
### Using an access token
37
+
38
+
Once you have an access token (whether via the script or from the user flow), you can pass that token into the InstagramAPI constructor:
39
+
29
40
from instagram.client import InstagramAPI
30
41
31
-
access_token = "..."
42
+
access_token = "YOUR_ACCESS_TOKEN"
32
43
api = InstagramAPI(access_token=access_token)
44
+
recent_media, next = instagram_client.user_recent_media(user_id=user.instagram_userid, count=count)
45
+
for media in recent_media:
46
+
print media.caption.text
47
+
48
+
### Making unauthenticated requests
49
+
50
+
For methods that don't require authentication, you can just pass your client ID and optionally client secret into the InstagramAPI
51
+
constructor:
52
+
53
+
api = InstagramAPI(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET')
33
54
popular_media = api.media_popular(count=20)
34
55
for media in popular_media:
35
56
print media.images['standard_resolution'].url
36
57
58
+
59
+
Real-time Subscriptions:
60
+
-----
61
+
62
+
See the docs for more on real-time subscriptions: http://instagr.am/developer/realtime/
63
+
64
+
You can use the API to subscribe to users, tags, locations, or geographies:
65
+
66
+
# Subscribe to updates for all users authenticated to your app
0 commit comments