Spaces:
Runtime error
Runtime error
import os | |
import string | |
import random | |
import tweepy | |
BEARER_TOKEN = os.environ.get("BEARER_TOKEN") | |
CONSUMER_KEY = os.environ.get("CONSUMER_KEY") | |
CONSUMER_SECRET = os.environ.get("CONSUMER_SECRET") | |
ACCESS_TOKEN = os.environ.get("ACCESS_TOKEN") | |
ACCESS_TOKEN_SECRET = os.environ.get("ACCESS_TOKEN_SECRET") | |
client = tweepy.Client( | |
bearer_token=BEARER_TOKEN, | |
consumer_key=CONSUMER_KEY, | |
consumer_secret=CONSUMER_SECRET, | |
access_token=ACCESS_TOKEN, | |
access_token_secret=ACCESS_TOKEN_SECRET, | |
) | |
length = 25 | |
letters = string.ascii_lowercase | |
result_str = ''.join(random.choice(letters) for i in range(length)) | |
response = client.create_tweet( | |
text=result_str | |
) | |
print("Done!") | |