Skip to content

Twitter bot class for PathX automated twitter posts using Python

Notifications You must be signed in to change notification settings

PathX-Projects/Twitter-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to Create Developer Credentials for the Twitter API:

  1. Go to https://developer.twitter.com/en/portal/projects-and-apps

  2. Create a new project: Screen-Shot-2022-09-20-at-1-10-48-PM

  3. Once you enter the app screen, create a new "development" app: Screen-Shot-2022-09-20-at-1-12-29-PM

  4. Once you get to the "Keys & Tokens" section, make sure that you copy and store the API Key and API Secret Key in a safe place. You will need them to authenticate with the TwitterBot class.

    Screen-Shot-2022-09-20-at-1-17-18-PM

  5. Then click "App Settings" -> then "Keys and Tokens." On this page you will need to generate an access token and access token secret. You will need these as well to authenticate with the TwitterBot class. Screen-Shot-2022-09-20-at-1-20-54-PM

How to Use These Credentials to Authenticate the TwitterBot Class:

from twitter_bot import TwitterBot

# Create a TwitterBot object
bot = TwitterBot(
    api_key="YOUR_TWITTER_API_KEY",
    api_secret_key="YOUR_TWITTER_API_SECRET_KEY",
    access_token="YOUR_TWITTER_ACCESS_TOKEN",
    access_token_secret="YOUR_TWITTER_ACCESS_TOKEN_SECRET"
)

How to Use the TwitterBot Class:

# Post a tweet
bot.post_tweet("Hello World!")

# Post a tweet with tags:
bot.post_tweet("Hello World!", tags=["bot", "python"])

# Post a tweet with an image:
bot.post_tweet("Hello World!", media_filepath="path/to/image.jpg")

About

Twitter bot class for PathX automated twitter posts using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages