Send tweets (with optional images) through the Twitter v2 API (OAuth 2.0) - authentication included
Project description
Tweeter Basic
Send tweets (with optional images) and authenticate through the Twitter v2 API (OAuth 2.0) using Python.
Quick Start
Send a test tweet with the following steps:
- generate and set the following environment variables:
- TWITTER_CONSUMER_API_KEY
- TWITTER_CONSUMER_API_KEY_SECRET
- TWITTER_ACCESS_TOKEN
- TWITTER_ACCESS_TOKEN_SECRET
- TWITTER_CLIENT_ID
- TWITTER_CLIENT_SECRET
- TWITTER_CALLBACK_URI <- must end in
/callback
(ie.http://localhost/callback
)
- authorize the application (1 time only) to generate the seed
token.json
with the following:- build & run the token generation server by executing
Authenticate/authenticate.sh
- navigate with a browser to your http://localhost/auth
- build & run the token generation server by executing
- send a test tweet by executing
test/test.sh
Prerequisites
- Docker engine
- Twitter project with:
- v1.1 API read & write access
- v2 API access
2do
- give a more verbose explanation of the steps
- write separate PyPI instructions
future
- add geolocation to tweets:
- try posting with the v1 API instead of v2:
- wait for an answer to https://stackoverflow.com/questions/75817366/how-to-post-a-tweet-with-geo-data-using-twitter-api-v2-0
- update forums when answer is found:
related projects
resources used
- helpful tutorials:
- Twitter POST /2/tweets
- Twitter POST /1.1/media/uploads.json
- media-upload.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tweeter-basic-0.1.1.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file tweeter-basic-0.1.1.tar.gz
.
File metadata
- Download URL: tweeter-basic-0.1.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 613e246f1b820c43a939875b0a58d987e34e708bfbff95d6db3e501646348ffe |
|
MD5 | 3bed2d4ac9c9f207fed771ecdbd54122 |
|
BLAKE2b-256 | 2688aee6cfae548699328cc3d35d31248b2612cccc5b3b3c9c93312d90a108d1 |
File details
Details for the file tweeter_basic-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: tweeter_basic-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3086af7d217af28b7925a17c940f16fb6b8c402dd0a90f61413c7a2b383afa1f |
|
MD5 | 70b3eb2a1b03a53b526c5ce97479c0ff |
|
BLAKE2b-256 | c1948a0589d754801919070dcac7a212a48427e3c560ca651b6c4bcd40b87fb9 |