tweepy.error.TweepError: Twitter error response: status code = 401

Solution 1:

401 is the Unauthorized status code. It means that your credentials (in this case, your consumer/access tokens) are invalid. Try re-creating the credentials correctly again following the instructions here.

Edit: If you're running exactly the code you posted, note that you must replace all the keys with the keys you generated using the above link.

EDIT:

As precised by LetsPlayYahtzee in comments below, it can also mean that you don't have access to the data you're requesting.

It can for instance happen when you're trying to retrieve tweets from a private user.