The tweepy Package

The tweepy package provides some useful tweeting capabilities. :bird: :bird:

Reference:

Setup

Create a Twitter Account. Then while logged in to Twitter, visit the Twitter Application Management Console and click "Create New App" to create a new Twitter Application. You might have to first sign up for a Twitter developer account, and click the link in a confirmation email.

After creating a new application, click on the "Keys and Access Tokens" tab, and note the application's "Consumer Key" and "Consumer Secret". Scroll down and generate a new Access Token and note its "Access Token" and "Access Token Secret" values. Store these four values as Environment Variables in a ".env" file in your project's root directory, like:

# the ".env" file...

TWITTER_API_KEY="______________"
TWITTER_API_SECRET="______________"
TWITTER_ACCESS_TOKEN="______________"
TWITTER_ACCESS_TOKEN_SECRET="______________"

Installation

Install tweepy, if necessary:

Usage

List your recent tweets:

Last updated

Was this helpful?