Spaces:
Runtime error
Runtime error
File size: 616 Bytes
949a823 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# model-fastapi/api_client.py
import tweepy
import os # Import modul os untuk mengakses variabel lingkungan
# Dapatkan token dari variabel lingkungan TWITTER_BEARER_TOKEN
# Jika token tidak ditemukan, client tidak akan terinisialisasi
BEARER_TOKEN = os.environ.get("AAAAAAAAAAAAAAAAAAAAAOGp3AEAAAAAMEaOafsh1pNGVFrK%2BN2atq0Cba4%3DE2Gw0MDFfJ1bE4veBIIxhOUqbaqQKOqRxMhGybH4FfOETDNpow")
if not BEARER_TOKEN:
raise ValueError("TWITTER_BEARER_TOKEN tidak ditemukan di environment variables.")
client = tweepy.Client(bearer_token=BEARER_TOKEN)
def get_tweets_by_username(username: str, count: int = 100):
pass |