Hello,

I am able to connect to the Twitter API using Tweepy and other python libraries like TwitterAPI and Twitter, however, when I try to retrieve my direct messages it returns an empty list even though I have received many DMs in the last 30 days. I am seeing this result with both Tweepy and Twitter libraries, so I do not believe the problem is specific to a library.

I would also like to note that I have read and write DMs enabled, and I have successfully sent DMs using tweepy.

I have seen this question on stackoverflow when googling, and no one has responded to it yet.

Code:
consumer_key = ‘xxxxxxxxx’
consumer_secret = ‘yyyyyyyy’
access_token = ‘aaaaaa’
access_token_secret = ‘bbbbbbbb’
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

#tweepy
api = tweepy.API(auth)

dms = api.list_direct_messages()
print(dms)
print(len(dms)

Output:

0

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.