PR_IRminiSaaS / app /utils /x_client.py
Corin1998's picture
Update app/utils/x_client.py
f95efe8 verified
raw
history blame contribute delete
387 Bytes
import tweepy
from app.config import settings
def post_to_x(text: str):
auth = tweepy.OAuth1UserHandler(
settings.X_API_KEY, settings.X_API_SECRET,
settings.X_ACCESS_TOKEN, settings.X_ACCESS_TOKEN_SECRET
)
api = tweepy.API(auth)
status = api.update_status(status=text[:270])
return {"id": status.id, "url": f"https://x.com/i/web/status/{status.id}"}