petarov / shut-up-bird

:bird: Put your tweets/likes in an EPUB and delete them like a boss
https://dev.to/petarov/help-me-delete-your-tweets-3a6
MIT License
21 stars 4 forks source link

401 error #1

Closed saurabh000345 closed 3 years ago

saurabh000345 commented 4 years ago

The authentication was successful, FYI

Authenticated as: saurabh000345
Traceback (most recent call last):
  File "/usr/bin/shut-up-bird.py", line 371, in <module>
    tweep_archive_likes(tweep_getAPI(g_auth),
  File "/usr/bin/shut-up-bird.py", line 62, in tweep_getAPI
    limits = api.rate_limit_status()
  File "/usr/lib/python3.8/site-packages/tweepy/binder.py", line 250, in _call
    return method.execute()
  File "/usr/lib/python3.8/site-packages/tweepy/binder.py", line 233, in execute
    raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: Twitter error response: status code = 401
[ERROR] Twitter error response: status code = 401
petarov commented 4 years ago

A 401 status code means that there was a problem authenticating your request, such as an invalid consumer key or secret. source

Check your Twitter Access Token. Maybe it was revoked.

saurabh000345 commented 4 years ago

A 401 status code means that there was a problem authenticating your request, such as an invalid consumer key or secret. source

Check your Twitter Access Token. Maybe it was revoked.

So how do I resolve this? while I'm pretty sure the correct code was entered (obvio I copied and pasted it), I'll sure like to try reverification. The help menu apparently doesn't let me revoke the authentication. Let me know if I'm missing something here.

$ shut-up-bird.py 
usage: shut-up-bird.py [-h] [-V] [-v] [-id MAX_ID] [-l] [-dt MAX_DATE] [-a] [-rt] [-re] [--remove]

So you're stuck, eh? Here're some hints.

optional arguments:
  -h, --help            show this help message and exit
  -V, --version         prints how old Smeagol is
  -v, --verbose         verbose (See what's happening)
  -id MAX_ID, --max-id MAX_ID
                        archives all statuses with an ID less than (older than) or equal to the specified
  -l, --likes           archives likes only
  -dt MAX_DATE, --max-date MAX_DATE
                        archives all statuses or likes with a post date earlier than or equal to the specified. Sample format: 2016-11-01
                        23:00:00+02:00
  -a, --asc             adds tweets in ascending date order
  -rt, --no-retweet     skips retweets
  -re, --no-reply       skips reply tweets
  --remove              removes all archived tweets. *** WARNING!!! This action is irreversible! ***
petarov commented 4 years ago

hmm, if the permissions are ok and the keys are right, then I don't see a reason for the 401 error 🤔. Is your twitter account by any chance private?

image
saurabh000345 commented 4 years ago

2020-03-09_14-42 Here's a screenshot of the permissions. And no, my account isn't set private.

Could you tell me where the cache files might be stored or something? I'd want to delete the file and try re-authenticating or something.

EDIT: The file is supposed to be ~/.shut-up-bird.conf as was mentioned in your README itself. But my Home directory doesn't have that file.

petarov commented 4 years ago

You could add print (config_path) right before line 260. This should print out the path to the .shut-up-bird.conf file when you run the script. There are no other config or cache files being used by the script.