{"id":18318760,"url":"https://github.com/xdevplatform/cat-pics","last_synced_at":"2025-04-05T21:33:14.843Z","repository":{"id":63603974,"uuid":"509138136","full_name":"xdevplatform/cat-pics","owner":"xdevplatform","description":"Resources for Tweeting cat pictures.","archived":false,"fork":false,"pushed_at":"2022-06-30T18:31:19.000Z","size":17,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-21T12:22:11.099Z","etag":null,"topics":["cats","flask","oauth2","the-cat-api","tweet","twitterapi-v2"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xdevplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-30T15:38:45.000Z","updated_at":"2025-03-10T18:26:32.000Z","dependencies_parsed_at":"2022-11-22T07:45:15.090Z","dependency_job_id":null,"html_url":"https://github.com/xdevplatform/cat-pics","commit_stats":null,"previous_names":["xdevplatform/cat-pics"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Fcat-pics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Fcat-pics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Fcat-pics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xdevplatform%2Fcat-pics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xdevplatform","download_url":"https://codeload.github.com/xdevplatform/cat-pics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406076,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cats","flask","oauth2","the-cat-api","tweet","twitterapi-v2"],"created_at":"2024-11-05T18:11:30.078Z","updated_at":"2025-04-05T21:33:14.577Z","avatar_url":"https://github.com/xdevplatform.png","language":"Python","readme":"# Cat pics!\nResources for Tweeting cat pictures.\n\n## Tutorial: Tweeting Media with v2 of the Twitter API in Python\nWith the launch of the manage Tweets endpoint, we included the ability to attach previously uploaded media to a Tweet. In addition, based on feedback we’ve heard from you, we recently added access to the v1 media endpoints for all users. \n\nCode that corresponds to [this tutorial](https://developer.twitter.com/en/docs/tutorials/tweeting-media-v2) can be found in the folder `v2-media-tutorial` in this repository.\n\nThis tutorial will walk you through how to Tweet images of cats using the manage Tweets endpoint of v2 and the v1.1 media endpoints in Python using Flask. Using OAuth 2.0. Authorization Code Flow with PKCE to request the Manage Tweets endpoint requires a user to log in. Therefore, you can use Flask as a web framework to parse the information dynamically.\n\n### Before you start\nBefore you start, you must install the required packages for this script, including `requests` for making HTTP requests to various endpoints, `tweepy` for working with OAuth 1.0a, `requests_oauthlib` for working with OAuth 2.0, and flask as a web framework.\n\n```python\npip install requests tweepy requests_oauthlib flask\n```\n\nIn your terminal, you will want to define the following environment variables:\n\n```\nexport CLIENT_ID=’xxxxxxxxxxxxxx’\nexport CLIENT_SECRET=’xxxxxxxxxxx’\nexport REDIRECT_URI=’http://127.0.0.1:5000/oauth/callback’\nexport API_KEY=’xxxxxxxxxxxxxx’\nexport API_SECRET=’xxxxxxxxxxx’\nexport ACCESS_TOKEN=’xxxxxxxxxxx’\nexport ACCESS_TOKEN_SECRET=’xxxxxxxxxxx’\n```\n\nYou can obtain your own OAuth 2.0 Client ID and Secret inside of the developer settings in the developer portal.\n\nYou will want to use your own credentials found in the [Developer Portal](https://developer.twitter.com/en/portal/dashboard) instead of of the value `xxxxxxxxxxxxxx`.\n\n## Factual cat image support\n[@FactualCat](https://twitter.com/FactualCat) is a bot that Tweets cat facts and now images using the code in the folder `factual-cat-image-support`. You will need to run `gsd.py` once locally to log in. After that you can use `every_other.py` to Tweet regularly.\n\nThis code is currently deployed to [Render](https://twitter.com/FactualCat) using [redis](https://render.com/docs/redis) and a [cron job](https://render.com/docs/cronjobs) to run twice daily.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Fcat-pics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxdevplatform%2Fcat-pics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxdevplatform%2Fcat-pics/lists"}