DEV Community

Cover image for 
⚡⚡⚡ 3 Tips and 1 Gist For Using Python and The Twitter Search API
Dylan
Dylan

Posted on

⚡⚡⚡ 3 Tips and 1 Gist For Using Python and The Twitter Search API

These past days I've been playing around with the Twitter Search API. Here are a few things that you may find useful if you are getting started with it:

  1. Use Tweepy. It's much better documented and easier to work with compared to python-twitter

  2. If you are only reading public data, use Application-only authentication. You can do up to 450 requests in a 15-min window. The Application-user authentication gives you only 180 requests in the same time window.

  3. Read the best practices for Standard Search. There's a lot of things you can do in the queries (e.g., filter by tweets' sentiment)

Finally, here's a simple gist that allows you to get the last 100 tweets for a given query and inserts them in a SQLite DB every 30 seconds: https://gist.github.com/dylanjcastillo/99a79d53a3d73d8eebf0a5c0b81531d1

Top comments (2)

Collapse
 
mridubhatnagar profile image
Mridu Bhatnagar

Hey Dylan.
Which tool did you use to create that GIF on the cover image?

Collapse
 
dylanjcastillo profile image
Dylan

Hi Mridu,

I used the MacOS screen recorder and then I transform it to a gif using: ezgif.com/video-to-gif