From d75527f7eecc4e2fcdd18ab157412506717c8adb Mon Sep 17 00:00:00 2001
From: navanchauhan
pip install tweepy
import os
+
+import os
import tweepy
consumer_key = os.environ["consumer_key"]
@@ -70,13 +71,15 @@ I am not handling lists or images right now.
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
-
+
+The program need to convert the blog post into text fragments.
It reads the markdown file, removes the top YAML content, checks for headers and splits the content.
-tweets = []
+
+tweets = []
first___n = 0
@@ -103,13 +106,15 @@ I am not handling lists or images right now.
print("ERROR")
else:
tweets.append(line)
-
+
+Every status update using tweepy has an id attached to it, for the next tweet in the thread, it adds that ID while calling the function.
For every tweet fragment, it also appends 1/n.
-for idx, tweet in enumerate(tweets):
+
+for idx, tweet in enumerate(tweets):
tweet += " {}/{}".format(idx+1,len(tweets))
if idx == 0:
a = None
@@ -118,12 +123,15 @@ I am not handling lists or images right now.
a = api.update_status(tweet,in_reply_to_status_id=a.id)
print(len(tweet),end=" ")
print("{}/{}\n".format(idx+1,len(tweets)))
-
+
+Finally, it replies to the last tweet in the thread with the link of the post.
-api.update_status("Web Version: {}".format(post_link))
-
api.update_status("Web Version: {}".format(post_link))
+
+