-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
41 lines (30 loc) · 1 KB
/
script.py
File metadata and controls
41 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import os
import tweepy
from datetime import date
import logging
import sys
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s',
stream=sys.stdout
)
logger = logging.getLogger()
def post_daily_tweet():
try:
release_date = date(2026, 11, 19)
today = date.today()
days_left = (release_date - today).days
tweet = f"There are {days_left} days left until the release of GTA 6. #GTA6 #GTAVI"
client = tweepy.Client(
consumer_key=os.getenv("API_KEY"),
consumer_secret=os.getenv("API_SECRET"),
access_token=os.getenv("ACCESS_TOKEN"),
access_token_secret=os.getenv("ACCESS_SECRET")
)
response = client.create_tweet(text=tweet)
logger.info(f"Tweet publicado exitosamente: {tweet}")
except Exception as e:
logger.error(f"Error al publicar el tweet: {e}")
sys.exit(1)
if __name__ == "__main__":
post_daily_tweet()