What will we cover
- All the steps from creating a twitter account to implement a working Python program that will post a message in that account.
To achieve that you need the to go through the following steps.
- Create a Twitter Account, if you don’t already have one.
- Apply for a developer account, otherwise you will not be able to use the Twitter API
- Create an App in Twitter, which is used to generate the tokens you need to connect your program.
- Generate the needed tokens.
- Install Tweepy, which is a Python library that makes all the API stuff easy for you.
- The actual Python program.
Well, let’s get ready.
Step 1: A Twitter Account
Okay, this one is simple. You need to have a Twitter account to tweet from. If you do not already have one, then go to twitter.com and create an account.
Step 2: Apply for a Developer Account
Yes, you need to apply for a developer account. Don’t worry it is an automated process and if you follow the instructions here, you should get it immediately.
Log in to developer.twitter.com with your twitter credentials (if it does not happen automatically).

See in the top right corner it says Apply. Press that and continue to this screen.

Press the “Apply for a developer account”. Then you end up here.

Choose under Hobbyist “Making a bot” and click Next.
That will guide you to a verification page. You might need to enter your phone number, your country and what to call you (your name).
You will be promoted by questions that you need to fill out.



And then press next. Verify the data you entered and press “Verify”. Then finally you need to submit the application.
Then you should receive an email with confirmation.
Step 3: Create an App
From the link in the confirmation mail you get directed to here.

Where you should find the menu with Apps and click it.

Then create an App. That is, you need to click “Create an app” in the upper right corner.

You should obviously enter you own URL.

Finally enter something similar and press create.

Step 4: Create Access tokens and get API tokens
To do that you need to click Keys and Tokens.

On that page you will get your API key and API secret key (not included in picture, but you should find them there).

Next is to generate Access token and Access token secret key. Press “Generate” and copy them. You will need them.

Step 5: Install Tweepy
Tweepy is an easy to use library to Python that will make your life easy. In a terminal type.
pip install tweepy
You might be using pip3 and you might need to be admin or install it locally.
Step 6: Implement your first Python Bot
Now to the fun stuff.
import tweepy
# You need to replace all these with your tokens.
consumer_key = "Replace this with your API token here"
consumer_secret = "Replace this with your API secret token here"
access_token = "Replace this with your Access token"
access_token_secret = "Replace this with your Access secret token"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
# Now this is actually doing what we want.
api.update_status(status="Hello, World!")
Python for Finance: Unlock Financial Freedom and Build Your Dream Life
Discover the key to financial freedom and secure your dream life with Python for Finance!
Say goodbye to financial anxiety and embrace a future filled with confidence and success. If you’re tired of struggling to pay bills and longing for a life of leisure, it’s time to take action.
Imagine breaking free from that dead-end job and opening doors to endless opportunities. With Python for Finance, you can acquire the invaluable skill of financial analysis that will revolutionize your life.
Make informed investment decisions, unlock the secrets of business financial performance, and maximize your money like never before. Gain the knowledge sought after by companies worldwide and become an indispensable asset in today’s competitive market.
Don’t let your dreams slip away. Master Python for Finance and pave your way to a profitable and fulfilling career. Start building the future you deserve today!
Python for Finance a 21 hours course that teaches investing with Python.
Learn pandas, NumPy, Matplotlib for Financial Analysis & learn how to Automate Value Investing.
“Excellent course for anyone trying to learn coding and investing.” – Lorenzo B.
