Learn How to Automate Twitter Posting with Python

Learn How to Automate Twitter Posting with Python

  • star
  • star
  • star
  • star
  • star
(2 Reviews)

Course Description

In this course you will learn from scratch how to automate twitter posts with a Python program code. This course is suitable for anyone - including people who have no prior programming knowledge - we will take you through step by step how to get python working on your computer and start writing code. We will teach you how to log in to your twitter account with a python program and (1) post a text, (2) post and image or (3) post a combination of an image with text. We will also teach you how to schedule posts for future, using data available from the internet through APIs. This course is suitable for people who want to learn how to schedule twitter posts using code - If you have multiple twitter accounts you need to schedule for and do not want to pay an arm and a leg and don't mind getting your hands dirty for online scheduling tools - then this is the course for you.

What you will learn

Learning Points, key take-aways

  • Get your Python development environment
  • Get your Twitter API keys
  • Automated twitter post - text only
  • Automated twitter post - image
  • Automated twitter post - image and text
  • Get data from internet using API for twitter post
  • Schedule twitter post - with future API data
  • Schedule randomised twitter posts for a whole month

Course Pre-requisites

  • None, anyone can do course

Course Skills

  • Basic Python Programming
  • Develop Twitter Bot for Scheduling posts


Curriculum

Section-1: Introduction

In this lecture we will cover the entire scope of this course. We will cover: (1) How to automate twitter text posts, (2) Twitter image posts, (3) Randomising twitter posts with text and images and (4) Making API calls

In this lecture we will install Python3 in our computers. You will learn how to search the internet for the latest Python Program - and download it in to your computer. We will also install a Code Editor and make sure it is all working and we are ready to write some python scripts. Download Python: https://www.python.org/ Download Atom: https://atom.io/

In this lecture we will learn about the process of getting your API keys from Twitter - you need this to supply your Python Application, to enable it to talk to Twitter. Links: https://developer.twitter.com/en/apps

We continue with the process of getting API keys and credentials from Twitter. Links: https://developer.twitter.com/en/apps

We continue with the process of getting API keys and credentials from Twitter. Links: https://developer.twitter.com/en/apps

Section-2: Automating Twitter with Python - The basics

Python libraries are lines of code written by third parties that can help you simplify your own code by utilising common methods already written by others. Utilising python libraries can reduce your code from hundreds of lines to just a few lines. In this exercise we will be using the python library Tweepy - which is a common twitter library for python - that helps you talk to the twitter API from your python program. Get Tweepy here: https://pypi.org/project/tweepy/

In this lecture we will be testing out Tweepy library and using the API keys we got in section one to send out very first text tweet. Exciting.

Section-3: Sending Automated Tweets - Intermediate

In this lecture we learn about how to use Tweepy to send tweets that include images, this same technique can be used for videos and gifs.

We learn in this lecture how to use another python library called random. We use this to select a random strings from a list of strings. This technique can be used to develop a list of possible tweets in advance - that you then write your python program to select daily a random tweet from your list. We also use the same technique to add hashtags to your tweet from another list of hashtags.

In this lecture we build on what we have learned to include a list of images in your random tweets. You can randomise your images, hashtags and strings. We also show you how make sure your tweet is always within the right number or characters allowed by twitter.

Section-4: Introducing Python Library - Requests

In this lecture we learn about Requests, a new Python Library that we can use to talk to the internet. We look at APIs we can use to draw data for our program - we are going to write a program that talks to a COVID-19 API to get daily updated COVID numbers from that API and post it to twitter. https://pypi.org/project/requests/

In this lecture we learn how to parse the JSON results returned from our API call - get the data that we need and structure it in to a tweet.

In this lecture we start to organise our python code in to specific functions. We have functions doing different things, and call on those functions when we need to. We write one function to get local country COVID data, another function to get global COVID data, another function to post random images ... and so forth - we combine everything we have learned in to different functions that we call when we need to - to randomise the posts. So your twitter feed looks more realistic - one day you are posting COVID numbers, the next day - images, and no one would guess it is all automated with a python program. This is ultimately what we want to achieve.

About Instructor

Bertha  Kgokong

Bertha Kgokong

Software Programmer and Tech Entrepreneur

Software Programmer and Tech Entrepreneur, i have extensive experience in Software Development - end-to-end in most platforms, Business Processes and Entrepreneurship. I am a fully qualified Engineer, with a Bachelors Degree and Masters in Business Administration - with over 17 years of professional experience. I am also an entrepreneur with a couple of award winning ventures and projects in Software Development.