i‘m totally new to python and tweepy. All i want to do is get all comments to a specific thread and save them in a txt. Really, i thought this couldn‘t be this hard, but i don‘t get it. I get the error:
Traceback (most recent call last):
File "iCloud Drive/Ohne Titel.py", line 9, in
<module>
conversation = client.conversation(conversa
tion_id)
AttributeError: 'Client' object has no attribut
e 'conversation'
The code:
import tweepy
BEARER_TOKEN = ' TOKEN '
client = tweepy.Client(BEARER_TOKEN)
# Get the conversation
conversation_id = " ID "
conversation = client.conversation(conversation_id)
# Save conversation to a text file
with open("conversation_{}.txt".format(conversation_id), "w") as f:
for tweet in conversation:
f.write(f"{tweet.author.name}: {tweet.text}\n\n")
print("Conversation saved to conversation_{}.txt".format(conversation_id))
Who can help me? Thanks in advance!
I do not see a
client.conversationoption in the Tweepy documentation. Did you by chance meanclient.dm_conversations?