c2siorg / b0bot

B0Bot - Bug Zero Twitter Bot
MIT License
15 stars 14 forks source link

Setup initial Flask API #5

Open BassCoder2808 opened 1 year ago

BassCoder2808 commented 1 year ago

Describe the solution you'd like This code creates a Flask application with a single endpoint /bot that accepts a POST request with a JSON payload containing the text of the tweet to be posted. It then uses the Tweepy library to authenticate with the Twitter API and post the tweet. Finally, it returns a JSON response with a success message.

Additional context The twitter_bot() function - it extracts the tweet text from the request data and posts it to Twitter using Tweepy.

Need to replace the consumer_key, consumer_secret, access_token, and access_token_secret variables with your own Twitter API credentials in order for the bot to work.

BassCoder2808 commented 1 year ago

@Niweera would love to hear from you about the same, like how can we setup the initial flask API, I have made an attempt for the same, please let me know, like how to proceed further