Before we can use the Twitter API we need to register for a developer account. 

Go to You should see a page something very like:

Click apply:

Then Apply for a developer account:

Select Exploring the API and click Next.

Fill out the form that gets presented, and clock Next. Verify the information, and click Next. Agree to the terms, and click Submit Application.

A verification email will be sent to your Twitter account's email address. Respond accordingly and you'll be able to create your app.

Creating an App

To access the Twitter API, you will need to create a Twitter app. On the Twitter Developer Portal, navigate to the Projects & Apps page and click Create App.

Name your app something unique. 

After naming your app, you'll be presented with your keys and tokens. Save all 3 keys and tokens somewhere safe on your computer, such as a text file on your desktop.

Open the file on your PyPortal and add your Twitter app's Bearer token as twitter_bearer_token.

Your file should look like this:

# This file is where you keep secret settings, passwords, and tokens!
# If you put them in the code you risk committing that info or sharing it

secrets = {
    'ssid' : 'home ssid',
    'password' : 'my password',
    'timezone' : "America/New_York", #
    'github_token' : 'fawfj23rakjnfawiefa',
    'hackaday_token' : 'h4xx0rs3kret',
    'twitter_bearer_token' : 'YOUR_SECRET_TWITTER_BEARER_TOKEN'

This guide was first published on Dec 29, 2020. It was last updated on Jul 22, 2024.

This page (Twitter Auth Keys) was last updated on Apr 09, 2024.

Text editor powered by tinymce.