· 6 years ago · Aug 02, 2019, 11:32 AM
1import twitter
2
3CONSUMER_KEY ='q0mrojIuBu7f77VZrpJ4w0byC'
4CONSUMER_SECRET = 'FpYOLGLiadRUVl0iX41dVu1RuGJXj43ca7znE1hnWrB5O2JfpQ'
5OAUTH_TOKEN = '1156898813598212096-Os0JxxIkfDCK3bR3gaow56USDNcGrm'
6OAUTH_TOKEN_SECRET = 'WOOlQlgVCBjzlcJi893MVcB0HGqYUg5FV69jMEY7FaAiC'
7
8auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
9 CONSUMER_KEY, CONSUMER_SECRET)
10
11twitter_api = twitter.Twitter(auth=auth)
12
13# Nothing to see by displaying twitter_api except that it's now a
14# defined variable
15
16print(twitter_api)
17
18TweePulz josshepp$ python3 TweePulz3.py
19Traceback (most recent call last):
20 File "TweePulz3.py", line 8, in <module>
21 auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
22AttributeError: module 'twitter' has no attribute 'oauth'