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
- create PyPI entry
- give a more verbose explanation of the steps
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.0.tar.gz
(4.9 kB
view details)
Built Distribution
File details
Details for the file tweeter-basic-0.1.0.tar.gz
.
File metadata
- Download URL: tweeter-basic-0.1.0.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 | d0b8ae619e3535ee1a5ef8605cb57aeef3f926c65c5e9f43b4f5ebf48ebb8886 |
|
MD5 | 5a04c0d79e6dabeeee1161bf8045129f |
|
BLAKE2b-256 | 414c789632365e84bb35630d491a81d8aa7c9fd3f4934cb1d5493d810b9d9bbd |
File details
Details for the file tweeter_basic-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tweeter_basic-0.1.0-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 | efce555162ed7c682d2c5388715b3a757854c735b72b04c50410690a0d06ccae |
|
MD5 | 07d02c44803f6c1d02c3358c07e37303 |
|
BLAKE2b-256 | 325ca02c3242bc3f3d06cacc3814448ad45c2e63e5cded3a5dc3e2032f22793f |