{"id":20539489,"url":"https://github.com/lestherll/tweet_search_client","last_synced_at":"2026-05-16T08:39:13.769Z","repository":{"id":44155557,"uuid":"502179517","full_name":"lestherll/tweet_search_client","owner":"lestherll","description":"A (WIP) client for searching and fetching tweets","archived":false,"fork":false,"pushed_at":"2022-07-20T01:25:37.000Z","size":546,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T14:45:48.646Z","etag":null,"topics":["python","twitter","twitter-api"],"latest_commit_sha":null,"homepage":"https://lestherll.github.io/tweet_search_client","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lestherll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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-10T20:59:31.000Z","updated_at":"2022-07-20T01:32:33.000Z","dependencies_parsed_at":"2022-07-30T09:07:58.176Z","dependency_job_id":null,"html_url":"https://github.com/lestherll/tweet_search_client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lestherll%2Ftweet_search_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lestherll%2Ftweet_search_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lestherll%2Ftweet_search_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lestherll%2Ftweet_search_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lestherll","download_url":"https://codeload.github.com/lestherll/tweet_search_client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242144583,"owners_count":20078970,"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":["python","twitter","twitter-api"],"created_at":"2024-11-16T00:52:25.949Z","updated_at":"2026-05-16T08:39:08.749Z","avatar_url":"https://github.com/lestherll.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twitter Search Client (WIP)\nAn unofficial **WIP** client for the twitter API that has only one goal; search for tweets.\n\n\n# Installation\nPackage is not ready for PyPI yet but it can be installed directly from GitHub using `pip`.\n```shell\npip install git+https://github.com/lestherll/twitter_search_client\n```\n\n# Setup and Prerequisites\nBefore everything, make sure that you have a developer account and a **bearer token** from Twitter. You can find out how to get one [here](https://developer.twitter.com/en/docs/twitter-api)\n\nProject requires you to create a `.env` file at the project root. The library forces you to create one by default so that there is less risk in leaking your credentials accidentally.\n\n`.env` file should look like below\n```env\nBEARER_TOKEN=your_bearer_token_that_you_got_from_twitter\n```\nThe bearer token will be automatically passed to `search_client.constants.config` and can be accessed as such.\n```py\nfrom search_client.constants import config\n\nprint(config.BEARER_TOKEN)\n```\n\nIn environments where creating a `.env` is not possible, you can just pass the bearer token directly to the `SearchClient` class. You must, however, be aware that you would be exposing your keys to others.\n```py\nfrom search_client import SearchClient\n\n\nclient = SearchClient(\"your_keys_must_be_string\")\n\n# do low-level work with client using /search/recent\ntweets = client.get_recent_tweets(query=[\"from:twitterDev\"])\n\n# do low-level work with client using /search/all\ntweets = client.get_all_tweets(query=[\"from:twitterDev\"])\n\n# do high-level work with client using /search/recent\ntweets = client.get_tweets(\n    query=[\"from:twitterDev\"],\n    number_of_tweets=10,\n    archive=False,          # default is False which uses /recent\n)\n\n# do high-level work with client using /search/all\ntweets = client.get_tweets(\n    query=[\"from:twitterDev\"],\n    number_of_tweets=10,\n    archive=True,           # archive must be set to True for /all\n)\n```\n\n# Usage\n[SearchClient](search_client/client.py) will be the interface exposed to the user. It will contain everything to do with searching tweets. It is  planned to use other endpoints of the Twitter API and expose them through other client types.\n\n### Main endpoints supported\n| Twitter API Endpoint              | Method                           | V2 Access Levels  |\n|-----------------------------------|----------------------------------|-------------------|\n| `/search/recent`                  | `SearchClient.get_recent_tweets` | Developer         |\n| `/search/all`                     | `SearchClient.get_all_tweets`    | Academic          |\n| `/search/all` or `/search/recent` | `SeachClient.get_tweets`         | Developer/Academic|\n| `/tweets/counts/all`              | `SearchClient.get_tweet_counts`  | Academic          |\n\nThese methods are low-level wrappers (except for `get_tweets`) over raw requests to their respective endpoints. [Enumerations](./search_client/field_enums.py) are provided forconvenience of passing [fields](https://developer.twitter.com/en/docs/twitter-api/fields) and [expansions](https://developer.twitter.com/en/docs/twitter-api/expansions).\n\nThere are other methods that `SearchClient` has and it is suggested to look through the [code](./search_client/client.py).\nDocumentation using `mkdocs` is currently being set up.\n\n# TODO\n- explore possible designs of a DSL for querying tweets\n- higher level interface that doesn't require users to know about Twitter API\n- examples\n- separate clients for count, tweet lookup, and user lookup endpoint\n- model for Tweet objects (currently uses dictionaries)\n- documentation\n- tests\n- CI/CD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flestherll%2Ftweet_search_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flestherll%2Ftweet_search_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flestherll%2Ftweet_search_client/lists"}