Building A Twitter Bot
Twitter makes it very easy for developers to use their API with reasonable rate limits.
Requirements
1. Email address to register Twitter Account
2. Mobile phone number to use the Developer API
3. A Server to host your Twitter Bot
Getting Started
There are 2 kinds of developer programs: Standard and Enterprise. We are going to cover only the basics of the Standard developer program. Go to https://apps.twitter.com/ and create an app.
Now that you have your ACCESS TOKEN, ACCESS SECRET, CONSUMER KEY and CONSUMER SECRET you have all the authentication required to program your twitter bot, in our case using Python.
Twitter Bot
The code is pretty simple. You will need to pip install tweepy and that's it. The while loop is optional you are free to use any other scheduling method like crontab. As shown in the snippet you can either post a simple status or a status with an image. There are a lot more that you can do with the library http://docs.tweepy.org/en/v3.5.0/api.html
As usual drop a comment if you have any question!
Comments
Post a Comment