{"id":28424972,"url":"https://github.com/truefoundry/truefoundry-python-sdk","last_synced_at":"2025-06-26T20:31:33.393Z","repository":{"id":290377950,"uuid":"940094262","full_name":"truefoundry/truefoundry-python-sdk","owner":"truefoundry","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-25T04:27:58.000Z","size":1190,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-25T05:27:17.467Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pypi.org/project/truefoundry-sdk/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/truefoundry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-02-27T15:53:40.000Z","updated_at":"2025-06-25T04:28:01.000Z","dependencies_parsed_at":"2025-04-28T14:33:25.406Z","dependency_job_id":"4d774c62-802b-42a1-a663-439c4af32825","html_url":"https://github.com/truefoundry/truefoundry-python-sdk","commit_stats":null,"previous_names":["truefoundry/truefoundry-python-sdk"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/truefoundry/truefoundry-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Ftruefoundry-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Ftruefoundry-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Ftruefoundry-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Ftruefoundry-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truefoundry","download_url":"https://codeload.github.com/truefoundry/truefoundry-python-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truefoundry%2Ftruefoundry-python-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262139493,"owners_count":23265164,"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":[],"created_at":"2025-06-05T10:30:56.828Z","updated_at":"2025-06-26T20:31:33.255Z","avatar_url":"https://github.com/truefoundry.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Truefoundry Python Library\n\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github\u0026utm_medium=github\u0026utm_campaign=readme\u0026utm_source=https%3A%2F%2Fgithub.com%2Ftruefoundry%2Ftruefoundry-python-sdk)\n[![pypi](https://img.shields.io/pypi/v/truefoundry-sdk)](https://pypi.python.org/pypi/truefoundry-sdk)\n\nThis library provides convenient access to the TrueFoundry API.\n\n\u003e [!tip]\n\u003e You can ask questions about this SDK using DeepWiki\n\u003e - Python: [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/truefoundry/truefoundry-python-sdk)\n\u003e - TypeScript: [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/truefoundry/truefoundry-typescript-sdk)\n\n\n## Installation\n\n```sh\npip install truefoundry-sdk\n```\n\n## Reference\n\nA full reference for this library is available [here](https://github.com/truefoundry/truefoundry-python-sdk/blob/HEAD/./reference.md).\n\n## Usage\n\nInstantiate and use the client with the following:\n\n```python\nfrom truefoundry_sdk import TrueFoundry\n\nclient = TrueFoundry(\n    api_key=\"YOUR_API_KEY\",\n    base_url=\"https://yourhost.com/path/to/api\",\n)\nresponse = client.applications.list(\n    limit=10,\n    offset=0,\n)\nfor item in response:\n    yield item\n# alternatively, you can paginate page-by-page\nfor page in response.iter_pages():\n    yield page\n```\n\n## Async Client\n\nThe SDK also exports an `async` client so that you can make non-blocking calls to our API.\n\n```python\nimport asyncio\n\nfrom truefoundry_sdk import AsyncTrueFoundry\n\nclient = AsyncTrueFoundry(\n    api_key=\"YOUR_API_KEY\",\n    base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -\u003e None:\n    response = await client.applications.list(\n        limit=10,\n        offset=0,\n    )\n    async for item in response:\n        yield item\n\n    # alternatively, you can paginate page-by-page\n    async for page in response.iter_pages():\n        yield page\n\n\nasyncio.run(main())\n```\n\n## Exception Handling\n\nWhen the API returns a non-success status code (4xx or 5xx response), a subclass of the following error\nwill be thrown.\n\n```python\nfrom truefoundry_sdk.core.api_error import ApiError\n\ntry:\n    client.applications.list(...)\nexcept ApiError as e:\n    print(e.status_code)\n    print(e.body)\n```\n\n## Pagination\n\nPaginated requests will return a `SyncPager` or `AsyncPager`, which can be used as generators for the underlying object.\n\n```python\nfrom truefoundry_sdk import TrueFoundry\n\nclient = TrueFoundry(\n    api_key=\"YOUR_API_KEY\",\n    base_url=\"https://yourhost.com/path/to/api\",\n)\nresponse = client.users.list(\n    limit=10,\n    offset=0,\n)\nfor item in response:\n    yield item\n# alternatively, you can paginate page-by-page\nfor page in response.iter_pages():\n    yield page\n```\n\n## Advanced\n\n### Access Raw Response Data\n\nThe SDK provides access to raw response data, including headers, through the `.with_raw_response` property.\nThe `.with_raw_response` property returns a \"raw\" client that can be used to access the `.headers` and `.data` attributes.\n\n```python\nfrom truefoundry_sdk import TrueFoundry\n\nclient = TrueFoundry(\n    ...,\n)\nresponse = client.applications.with_raw_response.list(...)\nprint(response.headers)  # access the response headers\nprint(response.data)  # access the underlying object\npager = client.users.list(...)\nprint(pager.response.headers)  # access the response headers for the first page\nfor item in pager:\n    print(item)  # access the underlying object(s)\nfor page in pager.iter_pages():\n    print(page.response.headers)  # access the response headers for each page\n    for item in page:\n        print(item)  # access the underlying object(s)\n```\n\n### Retries\n\nThe SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long\nas the request is deemed retryable and the number of retry attempts has not grown larger than the configured\nretry limit (default: 2).\n\nA request is deemed retryable when any of the following HTTP status codes is returned:\n\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)\n\nUse the `max_retries` request option to configure this behavior.\n\n```python\nclient.applications.list(..., request_options={\n    \"max_retries\": 1\n})\n```\n\n### Timeouts\n\nThe SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.\n\n```python\n\nfrom truefoundry_sdk import TrueFoundry\n\nclient = TrueFoundry(\n    ...,\n    timeout=20.0,\n)\n\n\n# Override timeout for a specific method\nclient.applications.list(..., request_options={\n    \"timeout_in_seconds\": 1\n})\n```\n\n### Custom Client\n\nYou can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies\nand transports.\n\n```python\nimport httpx\nfrom truefoundry_sdk import TrueFoundry\n\nclient = TrueFoundry(\n    ...,\n    httpx_client=httpx.Client(\n        proxies=\"http://my.test.proxy.example.com\",\n        transport=httpx.HTTPTransport(local_address=\"0.0.0.0\"),\n    ),\n)\n```\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a PR as\na proof of concept, but know that we will not be able to merge it as-is. We suggest opening\nan issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruefoundry%2Ftruefoundry-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruefoundry%2Ftruefoundry-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruefoundry%2Ftruefoundry-python-sdk/lists"}