0

I need to know if I am using the following code correctly.

tweets = helpers.get_user_timeline(sys.argv[1], 50)

Immediately after this line of code, I check to make sure I found tweets with:

if tweets is None:
    sys.exit("Not a valid screen_name")

Upon running my code using several valid Twitter user names, my program exits with "Not a valid screen_name".

I am assuming that my code is not retrieving the tweets. Yes, I did remember to import helpers.

2
  • Are you passing the username with a preceding @? get_user_timeline() would not like this. – Steve Bunting Mar 1 '17 at 9:37
  • Had that problem for names containing @, I found .lstrip("@") in application.py, removes preceding @. – Blauelf Mar 1 '17 at 10:29
0

Thank you. Using .lstrip("@") did the trick.

4
  • Please don't add "thank you" as an answer. Instead, accept the answer that you found most helpful. - From Review – Cliff B Mar 2 '17 at 12:23
  • It would't let me accept either answer. It still won't unless I forgot how this works. – Flesheaters Mar 2 '17 at 20:28
  • Thay can't be accepted because they're comments, not answers. Not your fault. Did you know that self-answers are not only acceptable but are encouraged? So, instead, can you please edit your answer and replace it with a description of what you did to correct the problem and then accept it? (You may have to wait up to 2 days to accept it.) That's the way to handle this! Happy coding! – Cliff B Mar 2 '17 at 23:48
  • Thanks for the tip, mate! – Flesheaters Mar 3 '17 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .