@@ -33,51 +33,50 @@ def compose_default_tweets(api_name, tweet_lines, media_ids=None):
33
33
return tweet
34
34
35
35
36
- # DEFAULT_TWEETS = [
37
- # compose_default_tweets("EOD Stock Market API", [
38
- # "- Exchange & Ticker Data",
39
- # "- (EOD) Stock Data",
40
- # "- Fundamental Data",
41
- # "- Financial News API",
42
- # "- Social Media Trend Data For Stocks",
43
- # "Create A free API Key today",
44
- # "https://eod-stock-api.site/plan-descriptions/basic"
45
- # ], media_ids=["1647575420009603073"]),
46
- # compose_default_tweets("Financial & Business News API", [
47
- # "- Articles By UUID",
48
- # "- Articles By Publishing Date",
49
- # "- Articles By Stock Tickers",
50
- # "- Articles By Exchange",
51
- # "- Get List of Exchanges & Tickers",
52
- # "- Get List of Publishers & Articles By Publisher",
53
- # "Create A free API Key today",
54
- # "https://bit.ly/financial-business-news-api"
55
- # ], media_ids=["1647575420009603073"]),
56
- # compose_default_tweets("Financial & Business Professional Plan", [
57
- # "- Exchange & Ticker Data",
58
- # "- (EOD) Stock Data",
59
- # "- Fundamental Data",
60
- # "- Financial News API",
61
- # "- Social Media Trend Data For Stocks",
62
- # "Subscribe to our Professional Plan Today",
63
- # "https://eod-stock-api.site/plan-descriptions/professional"
64
- # ], media_ids=["1647575420009603073"]),
65
- # compose_default_tweets("Financial & Business Business Plan", [
66
- # "- Exchange & Ticker Data",
67
- # "- (EOD) Stock Data",
68
- # "- Fundamental Data",
69
- # "- Financial News API",
70
- # "- Social Media Trend Data For Stocks",
71
- # "Subscribe to our Business Plan Today",
72
- # "https://eod-stock-api.site/plan-descriptions/business"
73
- # ], media_ids=["1647575420009603073"])
74
- # ]
75
-
76
- DEFAULT_TWEETS = []
36
+ DEFAULT_TWEETS = [
37
+ compose_default_tweets ("EOD Stock Market API" , [
38
+ "- Exchange & Ticker Data" ,
39
+ "- (EOD) Stock Data" ,
40
+ "- Fundamental Data" ,
41
+ "- Financial News API" ,
42
+ "- Social Media Trend Data For Stocks" ,
43
+ "Create A free API Key today" ,
44
+ "https://eod-stock-api.site/plan-descriptions/basic"
45
+ ], media_ids = ["1647575420009603073" ]),
46
+ compose_default_tweets ("Financial & Business News API" , [
47
+ "- Articles By UUID" ,
48
+ "- Articles By Publishing Date" ,
49
+ "- Articles By Stock Tickers" ,
50
+ "- Articles By Exchange" ,
51
+ "- Get List of Exchanges & Tickers" ,
52
+ "- Get List of Publishers & Articles By Publisher" ,
53
+ "Create A free API Key today" ,
54
+ "https://bit.ly/financial-business-news-api"
55
+ ], media_ids = ["1647575420009603073" ]),
56
+ compose_default_tweets ("Financial & Business Professional Plan" , [
57
+ "- Exchange & Ticker Data" ,
58
+ "- (EOD) Stock Data" ,
59
+ "- Fundamental Data" ,
60
+ "- Financial News API" ,
61
+ "- Social Media Trend Data For Stocks" ,
62
+ "Subscribe to our Professional Plan Today" ,
63
+ "https://eod-stock-api.site/plan-descriptions/professional"
64
+ ], media_ids = ["1647575420009603073" ]),
65
+ compose_default_tweets ("Financial & Business Business Plan" , [
66
+ "- Exchange & Ticker Data" ,
67
+ "- (EOD) Stock Data" ,
68
+ "- Fundamental Data" ,
69
+ "- Financial News API" ,
70
+ "- Social Media Trend Data For Stocks" ,
71
+ "Subscribe to our Business Plan Today" ,
72
+ "https://eod-stock-api.site/plan-descriptions/business"
73
+ ], media_ids = ["1647575420009603073" ])
74
+ ]
75
+
77
76
78
77
class TaskScheduler :
79
78
def __init__ (self ):
80
-
79
+ self . _run_counter = 0
81
80
self ._tweepy_api = tweepy .API (auth = auth )
82
81
self ._article_queue = Queue ()
83
82
self ._tweet_queue = Queue ()
@@ -159,8 +158,9 @@ async def create_tweets(self):
159
158
then send the tweet based on the article using send_tweet
160
159
:return:
161
160
"""
162
- for tweet in DEFAULT_TWEETS :
163
- await self ._tweet_queue .put (tweet )
161
+ if self ._run_counter % 5 == 0 :
162
+ for tweet in DEFAULT_TWEETS :
163
+ await self ._tweet_queue .put (tweet )
164
164
165
165
while self ._article_queue .qsize () > 0 :
166
166
self ._logger .info (f"Articles Found : { self ._article_queue .qsize ()} " )
@@ -174,6 +174,7 @@ async def create_tweets(self):
174
174
except ValidationError as e :
175
175
self ._logger .error (f"Error Creating Tweet: { str (e )} " )
176
176
pass
177
+ self ._run_counter += 1
177
178
178
179
async def run (self ):
179
180
self ._logger .info ("Started Run" )
0 commit comments