This repository was archived by the owner on Mar 12, 2025. It is now read-only.
File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 4
4
import tweepy
5
5
6
6
# 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 ]
9
10
10
11
# 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"
13
14
14
15
# Get secrets from environment
15
16
consumer_key = os .environ .get ("CONSUMER_KEY" )
28
29
logging .info (f"Media uploaded to twitter; response = [{ media } ]" )
29
30
30
31
# 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
+
You can’t perform that action at this time.
0 commit comments