Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
tweepy
Commits
17cdae7f
Commit
17cdae7f
authored
Sep 29, 2009
by
Josh Roesslein
Browse files
Add an oauth example script.
parent
a079bf3a
Changes
1
Show whitespace changes
Inline
Side-by-side
examples/outh/getaccesstoken.py
0 → 100644
View file @
17cdae7f
import
webbrowser
import
tweepy
"""
Query the user for their consumer key/secret
then attempt to fetch a valid access token.
"""
if
__name__
==
"__main__"
:
consumer_key
=
raw_input
(
'Consumer key: '
).
strip
()
consumer_secret
=
raw_input
(
'Consumer secret: '
).
strip
()
auth
=
tweepy
.
OAuthHandler
(
consumer_key
,
consumer_secret
)
# Open authorization URL in browser
webbrowser
.
open
(
auth
.
get_authorization_url
())
# Ask user for verifier pin
pin
=
raw_input
(
'Verification pin number from twitter.com: '
).
strip
()
# Get access token
token
=
auth
.
get_access_token
(
verifier
=
pin
)
# Give user the access token
print
'Access token:'
print
' Key: %s'
%
token
.
key
print
' Secret: %s'
%
token
.
secret
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment