forked from facebookarchive/python-instagram
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding get_access_token helper script
Adding test_settings support for local settings, and putting it in .gitignore
- Loading branch information
Mike Krieger
committed
Feb 2, 2011
1 parent
f84f047
commit 42b4927
Showing
3 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
*.pyc | ||
.DS_Store | ||
*.swp | ||
test_settings.py | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from instagram.client import InstagramAPI | ||
|
||
try: | ||
from test_settings import * | ||
|
||
InstagramAPI.host = test_host | ||
InstagramAPI.base_path = test_base_path | ||
InstagramAPI.access_token_field = "access_token" | ||
InstagramAPI.authorize_url = test_authorize_url | ||
InstagramAPI.access_token_url = test_access_token_url | ||
InstagramAPI.protocol = test_protocol | ||
except Exception: | ||
pass | ||
|
||
client_id = raw_input("Client ID: ").strip() | ||
client_secret = raw_input("Client Secret: ").strip() | ||
redirect_uri = raw_input("Redirect URI: ").strip() | ||
|
||
api = InstagramAPI(client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri) | ||
redirect_uri = api.get_authorize_login_url() | ||
|
||
print "Visit this page and authorize access in your browser:\n", redirect_uri | ||
|
||
code = raw_input("Paste in code in query string after redirect: ").strip() | ||
|
||
access_token = api.exchange_code_for_access_token(code) | ||
print "access token:\n", access_token | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters