bear / python-twitter

A Python wrapper around the Twitter API.
Apache License 2.0
3.41k stars 955 forks source link

Tons of errors when running script for the first time. #632

Closed Flipp3rrr closed 4 years ago

Flipp3rrr commented 4 years ago

Problem

When I tried using this library for my Twitter application I immediately ran into problems; tons of errors. I have put the code and error log below.

Code

import twitter

api = twitter.Api(consumer_key=["NO U"],
                  consumer_secret=["NO U"],
                  access_token_key=["NO U"],
                  access_token_secret=["NO U"])

statuses = api.GetUserTimeline(screen_name="Flipp3rrr")
print([s.text for s in statuses])

NB: In the real script "NO U" is replaced with the token.

Error log

https://pastebin.com/RHTfT7Z5

jeremylow commented 4 years ago

Are you putting the keys/tokens in a list []? They should be the strings like here https://github.com/bear/python-twitter/blob/master/examples/view_friends.py On Sep 26, 2019, 12:26 PM -0700, Flipp3rrr notifications@github.com, wrote:

Problem When I tried using this library for my Twitter application I immediately ran into problems; tons of errors. I have put the code and error log below. Code import twitter

api = twitter.Api(consumer_key=["NO U"], consumer_secret=["NO U"], access_token_key=["NO U"], access_token_secret=["NO U"])

statuses = api.GetUserTimeline(screen_name="Flipp3rrr") print([s.text for s in statuses]) NB: In the real script "NO U" is replaced with the token. Error log https://pastebin.com/RHTfT7Z5 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

Flipp3rrr commented 4 years ago

@jeremylow I used it like this:

api = twitter.Api(consumer_key=["asdfasdf123"],
                  consumer_secret=["asdfasdf123"],
                  access_token_key=["asdfasdf123"],
                  access_token_secret=["asdfasdf123"])

Is this incorrect?

talvalin commented 4 years ago

Based on the example given, yes that is incorrect. Try this? (I used single quotes for consistency with the example code)

api = twitter.Api(consumer_key='asdfasdf123',
                  consumer_secret='asdfasdf123',
                  access_token_key='asdfasdf123',
                  access_token_secret='asdfasdf123')
jeremylow commented 4 years ago

Yeah, that's how it should be run.