{"id":42382143,"url":"https://github.com/rly0nheart/searchcode-python","last_synced_at":"2026-01-27T22:04:08.347Z","repository":{"id":63905324,"uuid":"569473200","full_name":"rly0nheart/searchcode-python","owner":"rly0nheart","description":"Python SDK and CLI utility for searchcode.com.","archived":false,"fork":false,"pushed_at":"2026-01-23T20:33:14.000Z","size":318,"stargazers_count":10,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-23T20:36:11.124Z","etag":null,"topics":["codesearch","searchcode"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/searchcode","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rly0nheart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"buy_me_a_coffee":"rly0nheart"}},"created_at":"2022-11-22T22:51:26.000Z","updated_at":"2026-01-23T15:12:16.000Z","dependencies_parsed_at":"2023-11-23T12:29:21.106Z","dependency_job_id":"10526fff-ed9f-415c-9568-bee9463a9482","html_url":"https://github.com/rly0nheart/searchcode-python","commit_stats":{"total_commits":51,"total_committers":1,"mean_commits":51.0,"dds":0.0,"last_synced_commit":"16f5e54c2f68924e9d1193decb87ee3e929b275d"},"previous_names":["rly0nheart/searchcode-sdk","rly0nheart/searchcode-python"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/rly0nheart/searchcode-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rly0nheart%2Fsearchcode-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rly0nheart%2Fsearchcode-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rly0nheart%2Fsearchcode-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rly0nheart%2Fsearchcode-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rly0nheart","download_url":"https://codeload.github.com/rly0nheart/searchcode-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rly0nheart%2Fsearchcode-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28823927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["codesearch","searchcode"],"created_at":"2026-01-27T22:04:06.360Z","updated_at":"2026-01-27T22:04:08.330Z","avatar_url":"https://github.com/rly0nheart.png","language":"Python","funding_links":["https://buymeacoffee.com/rly0nheart"],"categories":["Python"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\r\n\u003cimg src=\"https://searchcode.com/logo.png\" width=300\u003e\u003cbr\u003e\u003cstrong\u003eSearchcode Python\u003c/strong\u003e: Python library and CLI utility for \u003ca href=\"https://searchcode.com\"\u003eSearchcode\u003c/a\u003e.\u003cbr\u003e\u003ci\u003eSimple, comprehensive code search.\u003c/i\u003e\u003c/p\u003e\r\n\u003cp align=\"center\"\u003e\u003c/p\u003e\r\n\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n\u003ch1\u003esearchcode.com is being rebooted\u003c/h1\u003e\r\n\u003cp\u003eAfter many years of helping developers find code snippets and examples, the time has come to reboot searchcode.com\u003c/p\u003e\r\n\u003cp\u003e\r\n    For a more detailed explanation of why this is happening, please read the full blog post: \u003ca href=\"https://boyter.org/posts/searchcode-is-being-rebooted/\"\u003esearchcode is being rebooted\u003c/a\u003e\r\n\u003c/p\u003e\r\n    \r\n\u003cdiv class=\"footer\"\u003e\r\n    \u003cp\u003e© searchcode.com\u003c/p\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\r\n\r\n\r\n```commandline\r\nsearchcode search \"import module\"\r\n```\r\n\r\nOr simply:\r\n\r\n```commandline\r\nsc search \"import module\"\r\n```\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\")\r\n\r\npprint(search)\r\n```\r\n\r\n## Installation\r\n\r\n```bash\r\n\r\npip install searchcode\r\n```\r\n\r\n## Getting Started\r\n\r\n### Code Search Without Filters\r\n\r\n#### Command-Line Interface\r\n\r\n```commandline\r\nsearchcode \"import module\"\r\n```\r\n\r\n#### In Code\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\")\r\n\r\npprint(search)\r\n```\r\n\r\n---\r\n\r\n### Filter by Language (Java and JavaScript)\r\n\r\n#### Command-Line Interface\r\n\r\n````commandline\r\nsearchcode \"import module\" --languages java,javascript\r\n````\r\n\r\n#### In Code\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\", languages=[\"Java\", \"JavaScript\"])\r\n\r\nfor result in search.results:\r\n    pprint(result.language)\r\n```\r\n\r\n___\r\n\r\n### Filter by Source (BitBucket and CodePlex)\r\n\r\n#### Command-Line Interface\r\n\r\n```commandline\r\nsearchcode \"import module\" --sources bitbucket,codeplex\r\n```\r\n\r\n#### In Code\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\", sources=[\"BitBucket\", \"CodePlex\"])\r\n\r\nfor result in search.results:\r\n    pprint(result.filename)\r\n```\r\n\r\n___\r\n\r\n### Filter by Lines of Code (Between 500 and 1000)\r\n\r\n#### Command-Line Interface\r\n\r\n```commandline\r\nsearchcode \"import module\" --lines-of-code-gt 500 --lines-of-code-lt 1000\r\n```\r\n\r\n#### In Code\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\", lines_of_code_gt=500, lines_of_code_lt=1000)\r\n\r\nfor result in search.results:\r\n    pprint(result)\r\n```\r\n\r\n___\r\n\r\n### With Callback Function (JSONP only)\r\n\r\n#### Command-Line Interface\r\n\r\n```commandline\r\nsearchcode \"import module\" --callback myCallback\r\n```\r\n\r\n#### In Code\r\n\r\n```python\r\nfrom pprint import pprint\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\nsearch = sc.search(query=\"import module\", callback=\"myCallback\")\r\n\r\npprint(search)\r\n```\r\n\r\n### Params\r\n\r\n- `query`: Search term (required).\r\n    - The following filters are textual and can be added into query directly\r\n        - Filter by file extention **ext:EXTENTION** e.g., _\"gsub ext:erb\"_\r\n        - Filter by language **lang:LANGUAGE** e.g., _\"import lang:python\"_\r\n        - Filter by repository **repo:REPONAME** e.g., _\"float Q_rsqrt repo:quake\"_\r\n        - Filter by user/repository **repo:USERNAME/REPONAME** e.g., _\"batf repo:boyter/batf\"_\r\n- `page`: Result page starting at 0 through to 49\r\n- `per_page`: Number of results wanted per page (max 100).\r\n- `languages`: List of programming languages to filter by.\r\n- `sources`: List of code sources (e.g., GitHub, BitBucket).\r\n- `lines_of_code_gt`: Filter to sources with greater lines of code than supplied int. Valid values 0 to 10000.\r\n- `lines_of_code_lt`: Filter to sources with less lines of code than supplied int. Valid values 0 to 10000.\r\n- `callback`: Callback function (JSONP only)\r\n\r\n\u003e If the results list is empty, then this indicates that you have reached the end of the available results.\r\n\r\n\u003e To fetch all results for a given query, keep incrementing `page` parameter until you get a page with an empty results\r\n\u003e list.\r\n___\r\n\r\n### Code Result\r\n\r\nReturns the raw data from a code file given the code id which can be found as the `id` in a code search result.\r\n\r\n#### Command-Line Interface\r\n\r\n```commandline\r\nsearchode code 4061576\r\n```\r\n\r\n#### In Code\r\n\r\n#### Params\r\n\r\n- `_id`: Unique identifier for the code file (required).\r\n\r\n```python\r\n\r\nfrom searchcode import Searchcode\r\n\r\nsc = Searchcode(user_agent=\"My-Searchcode-script\")\r\ndata = sc.code(4061576)\r\n\r\nprint(data.language)\r\nprint(data.code)\r\n```\r\n\r\n---\r\n\r\n## About Searchcode\r\n\r\nSearchcode is a simple, comprehensive source code search engine that indexes billions of lines of code from open-source\r\nprojects,\r\nhelping you find real world examples of functions, API's and libraries in 243 languages across 10+ public code sources.\r\n\r\n[Learn more](https://searchcode.com/about)\r\n\r\n## Credits\r\n\r\nThis SDK is developed and maintained by [Ritchie Mwewa](https://gravatar.com/rly0nheart), in collaboration\r\nwith [Ben Boyter](https://boyter.org/about/), the creator of [Searchcode.com](https://searchcode.com).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frly0nheart%2Fsearchcode-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frly0nheart%2Fsearchcode-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frly0nheart%2Fsearchcode-python/lists"}