As Twitter has cemented itself as a critical component of public discourse it has also become a vital tool for researchers across a variety of disciplines. The Twitter API provides an avenue for these researchers to access the contents of the social media platform from up-to-date tweet content, historical tweet interaction timelines, and follower network relationships.
In this 2-hour Tufts DISC workshop we will learn some of the basics of API querying, we will have an opportunity to retrieve Twitter data using the Twitter API, we will do some exploratory analysis of Twitter data, and we will do this all in a data scientist approved Python environment. No prior knowledge of Python will be assumed. It is suggested that participants set up a Twitter developer account prior to the workshop, using the instructions below, but for those who are unable to do so, credentials for a group account will also be made available for the duration of the workshop.
Before you can access the Twitter API you’ll need to have a Twitter developer account. You can apply for access as an academic researcher at the Twitter Developer Portal. This process usually take several days.
Once you’ve been granted access, you can login to your Developer Dashboard to retrieve your access tokens.
Be sure to copy down your keys and tokens into a text file where you can find them later.
Once we have developer credentials, there are several different tools that we can use to access the API. Here are a few of them.
You can try out some of these tools by working through this Google Colab Notebook (_you’ll need to supply your own developer credentials).