# 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](http://localhost/auth)
- 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:
- https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update
- using this format: https://en.wikipedia.org/wiki/GeoJSON
- 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:
- https://twittercommunity.com/t/how-tweet-with-latitude-longitude-information/189749
### related projects
- https://twitter.com/detroitships
- https://github.com/ezod/aistweet
- [testing grounds](https://twitter.com/HyperB0t)
### resources used
- helpful tutorials:
- https://developer.twitter.com/en/docs/tutorials/creating-a-twitter-bot-with-python--oauth-2-0--and-v2-of-the-twi
- https://dev.to/twitterdev/handling-refresh-tokens-in-the-oauth-20-authorization-code-flow-with-pkce-with-flask-481p
- [Twitter POST /2/tweets](https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets)
- [Twitter POST /1.1/media/uploads.json](https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload)
- [v2 uploading future](https://trello.com/c/Zr9zDrJx/109-replacement-of-media-uploads-functionality)
- [media-upload.py](https://gist.github.com/jcipriano/133e44156837360197ba17e7113ddfbc)
Raw data
{
"_id": null,
"home_page": "https://mike.busuttil.ca/",
"name": "tweeter-basic",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "tweet,twitter,v2,OAuth,OAuth2.0,API,images",
"author": "Mike Busuttil",
"author_email": "mike@busuttil.ca",
"download_url": "https://files.pythonhosted.org/packages/26/88/aee6cfae548699328cc3d35d31248b2612cccc5b3b3c9c93312d90a108d1/tweeter-basic-0.1.1.tar.gz",
"platform": null,
"description": "# Tweeter Basic\n\nSend tweets (with optional images) and authenticate through the Twitter v2 API (OAuth 2.0) using Python.\n\n## Quick Start\n\nSend a test tweet with the following steps:\n\n- generate and set the following environment variables:\n - TWITTER_CONSUMER_API_KEY\n - TWITTER_CONSUMER_API_KEY_SECRET\n - TWITTER_ACCESS_TOKEN\n - TWITTER_ACCESS_TOKEN_SECRET\n - TWITTER_CLIENT_ID\n - TWITTER_CLIENT_SECRET\n - TWITTER_CALLBACK_URI <- must end in `/callback` (ie. `http://localhost/callback`)\n- authorize the application (1 time only) to generate the seed `token.json` with the following:\n - build & run the token generation server by executing `Authenticate/authenticate.sh`\n - navigate with a browser to your [http://localhost/auth](http://localhost/auth)\n- send a test tweet by executing `test/test.sh`\n\n## Prerequisites\n\n- Docker engine\n- Twitter project with: \n - v1.1 API read & write access\n - v2 API access\n\n## 2do\n\n- give a more verbose explanation of the steps\n- write separate PyPI instructions\n\n### future\n\n- add geolocation to tweets:\n - try posting with the v1 API instead of v2:\n - https://developer.twitter.com/en/docs/twitter-api/v1/tweets/post-and-engage/api-reference/post-statuses-update\n - using this format: https://en.wikipedia.org/wiki/GeoJSON\n - wait for an answer to https://stackoverflow.com/questions/75817366/how-to-post-a-tweet-with-geo-data-using-twitter-api-v2-0\n - update forums when answer is found:\n - https://twittercommunity.com/t/how-tweet-with-latitude-longitude-information/189749\n\n### related projects\n\n- https://twitter.com/detroitships\n- https://github.com/ezod/aistweet\n- [testing grounds](https://twitter.com/HyperB0t)\n\n### resources used\n\n- helpful tutorials:\n - https://developer.twitter.com/en/docs/tutorials/creating-a-twitter-bot-with-python--oauth-2-0--and-v2-of-the-twi\n - https://dev.to/twitterdev/handling-refresh-tokens-in-the-oauth-20-authorization-code-flow-with-pkce-with-flask-481p\n- [Twitter POST /2/tweets](https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets)\n- [Twitter POST /1.1/media/uploads.json](https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload)\n - [v2 uploading future](https://trello.com/c/Zr9zDrJx/109-replacement-of-media-uploads-functionality)\n- [media-upload.py](https://gist.github.com/jcipriano/133e44156837360197ba17e7113ddfbc)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Send tweets (with optional images) through the Twitter v2 API (OAuth 2.0) - authentication included",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://mike.busuttil.ca/"
},
"split_keywords": [
"tweet",
"twitter",
"v2",
"oauth",
"oauth2.0",
"api",
"images"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c1948a0589d754801919070dcac7a212a48427e3c560ca651b6c4bcd40b87fb9",
"md5": "70b3eb2a1b03a53b526c5ce97479c0ff",
"sha256": "3086af7d217af28b7925a17c940f16fb6b8c402dd0a90f61413c7a2b383afa1f"
},
"downloads": -1,
"filename": "tweeter_basic-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "70b3eb2a1b03a53b526c5ce97479c0ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5244,
"upload_time": "2023-06-21T04:43:07",
"upload_time_iso_8601": "2023-06-21T04:43:07.845144Z",
"url": "https://files.pythonhosted.org/packages/c1/94/8a0589d754801919070dcac7a212a48427e3c560ca651b6c4bcd40b87fb9/tweeter_basic-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2688aee6cfae548699328cc3d35d31248b2612cccc5b3b3c9c93312d90a108d1",
"md5": "3bed2d4ac9c9f207fed771ecdbd54122",
"sha256": "613e246f1b820c43a939875b0a58d987e34e708bfbff95d6db3e501646348ffe"
},
"downloads": -1,
"filename": "tweeter-basic-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "3bed2d4ac9c9f207fed771ecdbd54122",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4872,
"upload_time": "2023-06-21T04:43:10",
"upload_time_iso_8601": "2023-06-21T04:43:10.060975Z",
"url": "https://files.pythonhosted.org/packages/26/88/aee6cfae548699328cc3d35d31248b2612cccc5b3b3c9c93312d90a108d1/tweeter-basic-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-21 04:43:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tweeter-basic"
}