Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 2fa9096

Browse files
authored
Merge pull request #34 from kwcckw/dev
Added debug section into tweet.
2 parents d86256b + 0f5dcf5 commit 2fa9096

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tweet.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
import tweepy
55

66
# Grab random image from daily build
7-
filename_display = random.choice(os.listdir("cropped/shabby/"))
8-
filename_upload = "cropped/shabby/" + filename_display
7+
filename = random.choice(os.listdir("cropped/shabby/"))
8+
filename_upload = "cropped/shabby/" + filename
9+
filename_display = os.path.splitext(filename)[0]
910

1011
# Create tweet message
11-
tweet = f"ShabbyPage-Of-The-Day using lastest build of Augraphy: {filename_display} "
12-
tweet = tweet + "#ShabbyPages #Augraphy #ImageAugmentation #ComputerVision #OpenCV #DataAugmentation #MachineLearning #imgaug #albumentations #deeplearning #kaggle #ml #ai"
12+
tweet_filename = f"ShabbyPage-Of-The-Day using lastest build of Augraphy: {filename_display} "
13+
tweet = tweet_filename + "#ShabbyPages #Augraphy #ImageAugmentation #ComputerVision #OpenCV #DataAugmentation #MachineLearning #imgaug #albumentations #deeplearning #kaggle #ml #ai"
1314

1415
# Get secrets from environment
1516
consumer_key = os.environ.get("CONSUMER_KEY")
@@ -28,5 +29,11 @@
2829
logging.info(f"Media uploaded to twitter; response = [{media}]")
2930

3031
# Post tweet with image
31-
post_result = api.update_status(status=tweet, media_ids=[media.media_id])
32-
logging.info(f"Tweet posted referencing media upload; response = [{post_result}] ")
32+
try:
33+
post_result = api.update_status(status=tweet, media_ids=[media.media_id])
34+
logging.info(f"Tweet posted referencing media upload; response = [{post_result}] ")
35+
except Exception as e:
36+
print(e)
37+
print("Length of tweet is "+len(tweet))
38+
print("Tweet is :"+tweet)
39+

0 commit comments

Comments
 (0)