Access correctly on_reply_to_tweet_id from the dict response returned by call to V2 API

This commit is contained in:
Manuel Cortez 2021-11-11 08:36:29 -06:00
parent b3bf0ab8e6
commit 622b0e6128

View File

@ -622,8 +622,7 @@ class Session(base.baseSession):
for obj in tweets: for obj in tweets:
if len(obj["attachments"]) == 0: if len(obj["attachments"]) == 0:
item = self.api_call_v2(call_name="create_tweet", text=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"]) item = self.api_call_v2(call_name="create_tweet", text=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"])
print(item) in_reply_to_status_id = item.data["id"]
in_reply_to_status_id = item.data.id
else: else:
media_ids = [] media_ids = []
for i in obj["attachments"]: for i in obj["attachments"]:
@ -632,7 +631,7 @@ class Session(base.baseSession):
self.api_call(call_name="create_media_metadata", media_id=img.media_id, alt_text=i["description"]) self.api_call(call_name="create_media_metadata", media_id=img.media_id, alt_text=i["description"])
media_ids.append(img.media_id) media_ids.append(img.media_id)
item = self.api_call_v2(call_name="create_tweet", status=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, media_ids=media_ids, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"]) item = self.api_call_v2(call_name="create_tweet", status=obj["text"], _sound="tweet_send.ogg", in_reply_to_tweet_id=in_reply_to_status_id, media_ids=media_ids, poll_duration_minutes=obj["poll_period"], poll_options=obj["poll_options"])
in_reply_to_status_id = item.data.id in_reply_to_status_id = item.data["id"]
def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs): def reply(self, text="", in_reply_to_status_id=None, attachments=[], *args, **kwargs):
if len(attachments) == 0: if len(attachments) == 0: