Skip to content

0xnotkyo/twt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

post tweets from terminal

📚 Table of Contents

🚀 Usage

  • post tweets from terminal like this
python3 twt.py "this tweet have been posted from my terminal"

⚙️ Installation

  1. Get API keys from developer.twitter.com.

    • Make a project/app, enable OAuth 1.0a
    • Set to "Read and Write" perms (IMPORTANT)
    • Copy your API Key and API Secret (also called consumer_key and consumer_secret)
  2. Create a file named secrets.json in the same directory as the script.

{
  "consumer_key": "your_api_key",
  "consumer_secret": "your_api_secret"
}
  1. Paste this in your config file and replace your_api_key and your_api_secret with the actual keys you obtained from Twitter.

  2. Run the script for the first time, passing the tweet text as an argument:

python3 twt.py "{text}"
  1. The script will output a URL like this, open it and authorize the app.
Please go here and authorize: https://api.twitter.com/oauth/authorize...
  1. Twitter will give you a PIN code. Copy it and paste the PIN code into the script when it asks:
Paste the PIN here:
  1. The script will complete the OAuth process and you will be able to post tweets using the script normally.

📦 Requirements

  • Python 3.x installed
  • requests_oauthlib library installed

📖 Docs

For more information about Twitter API OAuth, see: