# speakeasy-client-sdk-python
<!-- Start SDK Installation [installation] -->
## SDK Installation
PIP
```bash
pip install speakeasy-client-sdk-python
```
Poetry
```bash
poetry add speakeasy-client-sdk-python
```
<!-- End SDK Installation [installation] -->
<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage
### Example
```python
# Synchronous Example
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.get_apis()
if res.apis is not None:
# handle response
pass
```
</br>
The same SDK client can also be used to make asychronous requests by importing asyncio.
```python
# Asynchronous Example
import asyncio
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
async def main():
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = await s.apis.get_apis_async()
if res.apis is not None:
# handle response
pass
asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->
<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations
### [apis](docs/sdks/apis/README.md)
* [delete_api](docs/sdks/apis/README.md#delete_api) - Delete an Api.
* [generate_open_api_spec](docs/sdks/apis/README.md#generate_open_api_spec) - Generate an OpenAPI specification for a particular Api.
* [generate_postman_collection](docs/sdks/apis/README.md#generate_postman_collection) - Generate a Postman collection for a particular Api.
* [get_all_api_versions](docs/sdks/apis/README.md#get_all_api_versions) - Get all Api versions for a particular ApiEndpoint.
* [get_apis](docs/sdks/apis/README.md#get_apis) - Get a list of Apis for a given workspace
* [upsert_api](docs/sdks/apis/README.md#upsert_api) - Upsert an Api
### [api_endpoints](docs/sdks/apiendpoints/README.md)
* [delete_api_endpoint](docs/sdks/apiendpoints/README.md#delete_api_endpoint) - Delete an ApiEndpoint.
* [find_api_endpoint](docs/sdks/apiendpoints/README.md#find_api_endpoint) - Find an ApiEndpoint via its displayName.
* [generate_open_api_spec_for_api_endpoint](docs/sdks/apiendpoints/README.md#generate_open_api_spec_for_api_endpoint) - Generate an OpenAPI specification for a particular ApiEndpoint.
* [generate_postman_collection_for_api_endpoint](docs/sdks/apiendpoints/README.md#generate_postman_collection_for_api_endpoint) - Generate a Postman collection for a particular ApiEndpoint.
* [get_all_api_endpoints](docs/sdks/apiendpoints/README.md#get_all_api_endpoints) - Get all Api endpoints for a particular apiID.
* [get_all_for_version_api_endpoints](docs/sdks/apiendpoints/README.md#get_all_for_version_api_endpoints) - Get all ApiEndpoints for a particular apiID and versionID.
* [get_api_endpoint](docs/sdks/apiendpoints/README.md#get_api_endpoint) - Get an ApiEndpoint.
* [upsert_api_endpoint](docs/sdks/apiendpoints/README.md#upsert_api_endpoint) - Upsert an ApiEndpoint.
### [metadata](docs/sdks/metadata/README.md)
* [delete_version_metadata](docs/sdks/metadata/README.md#delete_version_metadata) - Delete metadata for a particular apiID and versionID.
* [get_version_metadata](docs/sdks/metadata/README.md#get_version_metadata) - Get all metadata for a particular apiID and versionID.
* [insert_version_metadata](docs/sdks/metadata/README.md#insert_version_metadata) - Insert metadata for a particular apiID and versionID.
### [schemas](docs/sdks/schemas/README.md)
* [delete_schema](docs/sdks/schemas/README.md#delete_schema) - Delete a particular schema revision for an Api.
* [download_schema](docs/sdks/schemas/README.md#download_schema) - Download the latest schema for a particular apiID.
* [download_schema_revision](docs/sdks/schemas/README.md#download_schema_revision) - Download a particular schema revision for an Api.
* [get_schema](docs/sdks/schemas/README.md#get_schema) - Get information about the latest schema.
* [get_schema_diff](docs/sdks/schemas/README.md#get_schema_diff) - Get a diff of two schema revisions for an Api.
* [get_schema_revision](docs/sdks/schemas/README.md#get_schema_revision) - Get information about a particular schema revision for an Api.
* [get_schemas](docs/sdks/schemas/README.md#get_schemas) - Get information about all schemas associated with a particular apiID.
* [register_schema](docs/sdks/schemas/README.md#register_schema) - Register a schema.
### [artifacts](docs/sdks/artifacts/README.md)
* [get_blob](docs/sdks/artifacts/README.md#get_blob) - Get blob for a particular digest
* [get_manifest](docs/sdks/artifacts/README.md#get_manifest) - Get manifest for a particular reference
* [get_namespaces](docs/sdks/artifacts/README.md#get_namespaces) - Each namespace contains many revisions.
* [get_oas_summary](docs/sdks/artifacts/README.md#get_oas_summary)
* [get_revisions](docs/sdks/artifacts/README.md#get_revisions)
* [get_tags](docs/sdks/artifacts/README.md#get_tags)
* [post_tags](docs/sdks/artifacts/README.md#post_tags) - Add tags to an existing revision
* [preflight](docs/sdks/artifacts/README.md#preflight) - Get access token for communicating with OCI distribution endpoints
### [auth](docs/sdks/auth/README.md)
* [get_access_token](docs/sdks/auth/README.md#get_access_token) - Get or refresh an access token for the current workspace.
* [get_user](docs/sdks/auth/README.md#get_user) - Get information about the current user.
* [get_workspace_access](docs/sdks/auth/README.md#get_workspace_access) - Get access allowances for a particular workspace
* [validate_api_key](docs/sdks/auth/README.md#validate_api_key) - Validate the current api key.
### [requests](docs/sdks/requests/README.md)
* [generate_request_postman_collection](docs/sdks/requests/README.md#generate_request_postman_collection) - Generate a Postman collection for a particular request.
* [get_request_from_event_log](docs/sdks/requests/README.md#get_request_from_event_log) - Get information about a particular request.
* [query_event_log](docs/sdks/requests/README.md#query_event_log) - Query the event log to retrieve a list of requests.
### [github](docs/sdks/github/README.md)
* [check_access](docs/sdks/github/README.md#check_access)
* [configure_code_samples](docs/sdks/github/README.md#configure_code_samples)
* [configure_mintlify_repo](docs/sdks/github/README.md#configure_mintlify_repo)
* [configure_target](docs/sdks/github/README.md#configure_target)
* [fetch_publishing_p_rs](docs/sdks/github/README.md#fetch_publishing_p_rs)
* [get_action](docs/sdks/github/README.md#get_action)
* [github_check_publishing_secrets](docs/sdks/github/README.md#github_check_publishing_secrets)
* [github_store_publishing_secrets](docs/sdks/github/README.md#github_store_publishing_secrets)
* [trigger_action](docs/sdks/github/README.md#trigger_action)
### [organizations](docs/sdks/organizations/README.md)
* [create_free_trial](docs/sdks/organizations/README.md#create_free_trial) - Create a free trial for an organization
* [get_organization](docs/sdks/organizations/README.md#get_organization) - Get organization
* [get_organization_usage](docs/sdks/organizations/README.md#get_organization_usage) - Get billing usage summary for a particular organization
* [get_organizations](docs/sdks/organizations/README.md#get_organizations) - Get organizations for a user
### [reports](docs/sdks/reports/README.md)
* [get_changes_report_signed_url](docs/sdks/reports/README.md#get_changes_report_signed_url) - Get the signed access url for the change reports for a particular document.
* [get_linting_report_signed_url](docs/sdks/reports/README.md#get_linting_report_signed_url) - Get the signed access url for the linting reports for a particular document.
* [upload_report](docs/sdks/reports/README.md#upload_report) - Upload a report.
### [short_ur_ls](docs/sdks/shorturls/README.md)
* [create](docs/sdks/shorturls/README.md#create) - Shorten a URL.
### [suggest](docs/sdks/suggest/README.md)
* [apply_operation_i_ds](docs/sdks/suggest/README.md#apply_operation_i_ds) - Apply operation ID suggestions and download result.
* [suggest_operation_i_ds](docs/sdks/suggest/README.md#suggest_operation_i_ds) - Generate operation ID suggestions.
* [suggest_operation_i_ds_registry](docs/sdks/suggest/README.md#suggest_operation_i_ds_registry) - Generate operation ID suggestions.
### [embeds](docs/sdks/embeds/README.md)
* [get_embed_access_token](docs/sdks/embeds/README.md#get_embed_access_token) - Get an embed access token for the current workspace.
* [get_valid_embed_access_tokens](docs/sdks/embeds/README.md#get_valid_embed_access_tokens) - Get all valid embed access tokens for the current workspace.
* [revoke_embed_access_token](docs/sdks/embeds/README.md#revoke_embed_access_token) - Revoke an embed access EmbedToken.
### [workspaces](docs/sdks/workspaces/README.md)
* [get_workspace](docs/sdks/workspaces/README.md#get_workspace) - Get workspace
### [events](docs/sdks/events/README.md)
* [get_workspace_events_by_target](docs/sdks/events/README.md#get_workspace_events_by_target) - Load recent events for a particular workspace
* [get_workspace_targets](docs/sdks/events/README.md#get_workspace_targets) - Load targets for a particular workspace
* [post_workspace_events](docs/sdks/events/README.md#post_workspace_events) - Post events for a specific workspace
* [search_workspace_events](docs/sdks/events/README.md#search_workspace_events) - Search events for a particular workspace by any field
<!-- End Available Resources and Operations [operations] -->
<!-- Start Error Handling [errors] -->
## Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
| Error Object | Status Code | Content Type |
| ---------------- | ---------------- | ---------------- |
| errors.Error | 5XX | application/json |
| errors.SDKError | 4xx-5xx | */* |
### Example
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import errors, shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = None
try:
res = s.events.get_workspace_events_by_target(request={
"target_id": "<value>",
})
except errors.Error as e:
# handle exception
raise(e)
except errors.SDKError as e:
# handle exception
raise(e)
if res.cli_event_batch is not None:
# handle response
pass
```
<!-- End Error Handling [errors] -->
<!-- Start Server Selection [server] -->
## Server Selection
### Select Server by Name
You can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
| Name | Server | Variables |
| ----- | ------ | --------- |
| `prod` | `https://api.prod.speakeasyapi.dev` | None |
#### Example
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
server="prod",
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.delete_api(request={
"api_id": "<value>",
"version_id": "<value>",
})
if res is not None:
# handle response
pass
```
### Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
server_url="https://api.prod.speakeasyapi.dev",
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.delete_api(request={
"api_id": "<value>",
"version_id": "<value>",
})
if res is not None:
# handle response
pass
```
<!-- End Server Selection [server] -->
<!-- Start Custom HTTP Client [http-client] -->
## Custom HTTP Client
The Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.
Depending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.
This allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.
For example, you could specify a header for every request that this sdk makes as follows:
```python
from speakeasy_client_sdk_python import Speakeasy
import httpx
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = Speakeasy(client=http_client)
```
or you could wrap the client with your own custom logic:
```python
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.httpclient import AsyncHttpClient
import httpx
class CustomClient(AsyncHttpClient):
client: AsyncHttpClient
def __init__(self, client: AsyncHttpClient):
self.client = client
async def send(
self,
request: httpx.Request,
*,
stream: bool = False,
auth: Union[
httpx._types.AuthTypes, httpx._client.UseClientDefault, None
] = httpx.USE_CLIENT_DEFAULT,
follow_redirects: Union[
bool, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
) -> httpx.Response:
request.headers["Client-Level-Header"] = "added by client"
return await self.client.send(
request, stream=stream, auth=auth, follow_redirects=follow_redirects
)
def build_request(
self,
method: str,
url: httpx._types.URLTypes,
*,
content: Optional[httpx._types.RequestContent] = None,
data: Optional[httpx._types.RequestData] = None,
files: Optional[httpx._types.RequestFiles] = None,
json: Optional[Any] = None,
params: Optional[httpx._types.QueryParamTypes] = None,
headers: Optional[httpx._types.HeaderTypes] = None,
cookies: Optional[httpx._types.CookieTypes] = None,
timeout: Union[
httpx._types.TimeoutTypes, httpx._client.UseClientDefault
] = httpx.USE_CLIENT_DEFAULT,
extensions: Optional[httpx._types.RequestExtensions] = None,
) -> httpx.Request:
return self.client.build_request(
method,
url,
content=content,
data=data,
files=files,
json=json,
params=params,
headers=headers,
cookies=cookies,
timeout=timeout,
extensions=extensions,
)
s = Speakeasy(async_client=CustomClient(httpx.AsyncClient()))
```
<!-- End Custom HTTP Client [http-client] -->
<!-- Start Authentication [security] -->
## Authentication
### Per-Client Security Schemes
This SDK supports the following security schemes globally:
| Name | Type | Scheme |
| ----------- | ----------- | ----------- |
| `api_key` | apiKey | API key |
| `bearer` | http | HTTP Bearer |
You can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.delete_api(request={
"api_id": "<value>",
"version_id": "<value>",
})
if res is not None:
# handle response
pass
```
<!-- End Authentication [security] -->
<!-- Start Global Parameters [global-parameters] -->
## Global Parameters
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
For example, you can set `workspaceID` to `"<value>"` at SDK initialization and then you do not have to pass the same value on calls to operations like `get_workspace`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
### Available Globals
The following global parameter is available.
| Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- |
| workspace_id | str | | The workspace_id parameter. |
### Example
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.workspaces.get_workspace()
if res.workspace is not None:
# handle response
pass
```
<!-- End Global Parameters [global-parameters] -->
<!-- Start Retries [retries] -->
## Retries
Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
```python
import os
from speakeasy.utils import BackoffStrategy, RetryConfig
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.delete_api(request={
"api_id": "<value>",
"version_id": "<value>",
},
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
if res is not None:
# handle response
pass
```
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
```python
import os
from speakeasy.utils import BackoffStrategy, RetryConfig
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.apis.delete_api(request={
"api_id": "<value>",
"version_id": "<value>",
})
if res is not None:
# handle response
pass
```
<!-- End Retries [retries] -->
<!-- Start File uploads [file-upload] -->
## File uploads
Certain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
> [!TIP]
>
> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.
>
```python
import os
from speakeasy_client_sdk_python import Speakeasy
from speakeasy_client_sdk_python.models import shared
s = Speakeasy(
security=shared.Security(
api_key=os.getenv("API_KEY", ""),
),
)
res = s.schemas.register_schema(request={
"request_body": {
"file": {
"content": open("<file_path>", "rb"),
"file_name": "your_file_here",
},
},
"api_id": "<value>",
"version_id": "<value>",
})
if res is not None:
# handle response
pass
```
<!-- End File uploads [file-upload] -->
<!-- Placeholder for Future Speakeasy SDK Sections -->
### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
Raw data
{
"_id": null,
"home_page": "https://github.com/speakeasy-api/speakeasy-client-sdk-python.git",
"name": "speakeasy-client-sdk-python",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Speakeasy",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/af/04/4330b40a721943c265ed9da2b234d7a8717fcb6ce287cc3d3cc334975f6f/speakeasy_client_sdk_python-6.3.0.tar.gz",
"platform": null,
"description": "# speakeasy-client-sdk-python\n\n<!-- Start SDK Installation [installation] -->\n## SDK Installation\n\nPIP\n```bash\npip install speakeasy-client-sdk-python\n```\n\nPoetry\n```bash\npoetry add speakeasy-client-sdk-python\n```\n<!-- End SDK Installation [installation] -->\n\n<!-- Start SDK Example Usage [usage] -->\n## SDK Example Usage\n\n### Example\n\n```python\n# Synchronous Example\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.get_apis()\n\nif res.apis is not None:\n # handle response\n pass\n```\n\n</br>\n\nThe same SDK client can also be used to make asychronous requests by importing asyncio.\n```python\n# Asynchronous Example\nimport asyncio\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\nasync def main():\n s = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n )\n res = await s.apis.get_apis_async()\n if res.apis is not None:\n # handle response\n pass\n\nasyncio.run(main())\n```\n<!-- End SDK Example Usage [usage] -->\n\n<!-- Start Available Resources and Operations [operations] -->\n## Available Resources and Operations\n\n### [apis](docs/sdks/apis/README.md)\n\n* [delete_api](docs/sdks/apis/README.md#delete_api) - Delete an Api.\n* [generate_open_api_spec](docs/sdks/apis/README.md#generate_open_api_spec) - Generate an OpenAPI specification for a particular Api.\n* [generate_postman_collection](docs/sdks/apis/README.md#generate_postman_collection) - Generate a Postman collection for a particular Api.\n* [get_all_api_versions](docs/sdks/apis/README.md#get_all_api_versions) - Get all Api versions for a particular ApiEndpoint.\n* [get_apis](docs/sdks/apis/README.md#get_apis) - Get a list of Apis for a given workspace\n* [upsert_api](docs/sdks/apis/README.md#upsert_api) - Upsert an Api\n\n### [api_endpoints](docs/sdks/apiendpoints/README.md)\n\n* [delete_api_endpoint](docs/sdks/apiendpoints/README.md#delete_api_endpoint) - Delete an ApiEndpoint.\n* [find_api_endpoint](docs/sdks/apiendpoints/README.md#find_api_endpoint) - Find an ApiEndpoint via its displayName.\n* [generate_open_api_spec_for_api_endpoint](docs/sdks/apiendpoints/README.md#generate_open_api_spec_for_api_endpoint) - Generate an OpenAPI specification for a particular ApiEndpoint.\n* [generate_postman_collection_for_api_endpoint](docs/sdks/apiendpoints/README.md#generate_postman_collection_for_api_endpoint) - Generate a Postman collection for a particular ApiEndpoint.\n* [get_all_api_endpoints](docs/sdks/apiendpoints/README.md#get_all_api_endpoints) - Get all Api endpoints for a particular apiID.\n* [get_all_for_version_api_endpoints](docs/sdks/apiendpoints/README.md#get_all_for_version_api_endpoints) - Get all ApiEndpoints for a particular apiID and versionID.\n* [get_api_endpoint](docs/sdks/apiendpoints/README.md#get_api_endpoint) - Get an ApiEndpoint.\n* [upsert_api_endpoint](docs/sdks/apiendpoints/README.md#upsert_api_endpoint) - Upsert an ApiEndpoint.\n\n### [metadata](docs/sdks/metadata/README.md)\n\n* [delete_version_metadata](docs/sdks/metadata/README.md#delete_version_metadata) - Delete metadata for a particular apiID and versionID.\n* [get_version_metadata](docs/sdks/metadata/README.md#get_version_metadata) - Get all metadata for a particular apiID and versionID.\n* [insert_version_metadata](docs/sdks/metadata/README.md#insert_version_metadata) - Insert metadata for a particular apiID and versionID.\n\n### [schemas](docs/sdks/schemas/README.md)\n\n* [delete_schema](docs/sdks/schemas/README.md#delete_schema) - Delete a particular schema revision for an Api.\n* [download_schema](docs/sdks/schemas/README.md#download_schema) - Download the latest schema for a particular apiID.\n* [download_schema_revision](docs/sdks/schemas/README.md#download_schema_revision) - Download a particular schema revision for an Api.\n* [get_schema](docs/sdks/schemas/README.md#get_schema) - Get information about the latest schema.\n* [get_schema_diff](docs/sdks/schemas/README.md#get_schema_diff) - Get a diff of two schema revisions for an Api.\n* [get_schema_revision](docs/sdks/schemas/README.md#get_schema_revision) - Get information about a particular schema revision for an Api.\n* [get_schemas](docs/sdks/schemas/README.md#get_schemas) - Get information about all schemas associated with a particular apiID.\n* [register_schema](docs/sdks/schemas/README.md#register_schema) - Register a schema.\n\n### [artifacts](docs/sdks/artifacts/README.md)\n\n* [get_blob](docs/sdks/artifacts/README.md#get_blob) - Get blob for a particular digest\n* [get_manifest](docs/sdks/artifacts/README.md#get_manifest) - Get manifest for a particular reference\n* [get_namespaces](docs/sdks/artifacts/README.md#get_namespaces) - Each namespace contains many revisions.\n* [get_oas_summary](docs/sdks/artifacts/README.md#get_oas_summary)\n* [get_revisions](docs/sdks/artifacts/README.md#get_revisions)\n* [get_tags](docs/sdks/artifacts/README.md#get_tags)\n* [post_tags](docs/sdks/artifacts/README.md#post_tags) - Add tags to an existing revision\n* [preflight](docs/sdks/artifacts/README.md#preflight) - Get access token for communicating with OCI distribution endpoints\n\n### [auth](docs/sdks/auth/README.md)\n\n* [get_access_token](docs/sdks/auth/README.md#get_access_token) - Get or refresh an access token for the current workspace.\n* [get_user](docs/sdks/auth/README.md#get_user) - Get information about the current user.\n* [get_workspace_access](docs/sdks/auth/README.md#get_workspace_access) - Get access allowances for a particular workspace\n* [validate_api_key](docs/sdks/auth/README.md#validate_api_key) - Validate the current api key.\n\n### [requests](docs/sdks/requests/README.md)\n\n* [generate_request_postman_collection](docs/sdks/requests/README.md#generate_request_postman_collection) - Generate a Postman collection for a particular request.\n* [get_request_from_event_log](docs/sdks/requests/README.md#get_request_from_event_log) - Get information about a particular request.\n* [query_event_log](docs/sdks/requests/README.md#query_event_log) - Query the event log to retrieve a list of requests.\n\n### [github](docs/sdks/github/README.md)\n\n* [check_access](docs/sdks/github/README.md#check_access)\n* [configure_code_samples](docs/sdks/github/README.md#configure_code_samples)\n* [configure_mintlify_repo](docs/sdks/github/README.md#configure_mintlify_repo)\n* [configure_target](docs/sdks/github/README.md#configure_target)\n* [fetch_publishing_p_rs](docs/sdks/github/README.md#fetch_publishing_p_rs)\n* [get_action](docs/sdks/github/README.md#get_action)\n* [github_check_publishing_secrets](docs/sdks/github/README.md#github_check_publishing_secrets)\n* [github_store_publishing_secrets](docs/sdks/github/README.md#github_store_publishing_secrets)\n* [trigger_action](docs/sdks/github/README.md#trigger_action)\n\n### [organizations](docs/sdks/organizations/README.md)\n\n* [create_free_trial](docs/sdks/organizations/README.md#create_free_trial) - Create a free trial for an organization\n* [get_organization](docs/sdks/organizations/README.md#get_organization) - Get organization\n* [get_organization_usage](docs/sdks/organizations/README.md#get_organization_usage) - Get billing usage summary for a particular organization\n* [get_organizations](docs/sdks/organizations/README.md#get_organizations) - Get organizations for a user\n\n### [reports](docs/sdks/reports/README.md)\n\n* [get_changes_report_signed_url](docs/sdks/reports/README.md#get_changes_report_signed_url) - Get the signed access url for the change reports for a particular document.\n* [get_linting_report_signed_url](docs/sdks/reports/README.md#get_linting_report_signed_url) - Get the signed access url for the linting reports for a particular document.\n* [upload_report](docs/sdks/reports/README.md#upload_report) - Upload a report.\n\n### [short_ur_ls](docs/sdks/shorturls/README.md)\n\n* [create](docs/sdks/shorturls/README.md#create) - Shorten a URL.\n\n### [suggest](docs/sdks/suggest/README.md)\n\n* [apply_operation_i_ds](docs/sdks/suggest/README.md#apply_operation_i_ds) - Apply operation ID suggestions and download result.\n* [suggest_operation_i_ds](docs/sdks/suggest/README.md#suggest_operation_i_ds) - Generate operation ID suggestions.\n* [suggest_operation_i_ds_registry](docs/sdks/suggest/README.md#suggest_operation_i_ds_registry) - Generate operation ID suggestions.\n\n### [embeds](docs/sdks/embeds/README.md)\n\n* [get_embed_access_token](docs/sdks/embeds/README.md#get_embed_access_token) - Get an embed access token for the current workspace.\n* [get_valid_embed_access_tokens](docs/sdks/embeds/README.md#get_valid_embed_access_tokens) - Get all valid embed access tokens for the current workspace.\n* [revoke_embed_access_token](docs/sdks/embeds/README.md#revoke_embed_access_token) - Revoke an embed access EmbedToken.\n\n### [workspaces](docs/sdks/workspaces/README.md)\n\n* [get_workspace](docs/sdks/workspaces/README.md#get_workspace) - Get workspace\n\n### [events](docs/sdks/events/README.md)\n\n* [get_workspace_events_by_target](docs/sdks/events/README.md#get_workspace_events_by_target) - Load recent events for a particular workspace\n* [get_workspace_targets](docs/sdks/events/README.md#get_workspace_targets) - Load targets for a particular workspace\n* [post_workspace_events](docs/sdks/events/README.md#post_workspace_events) - Post events for a specific workspace\n* [search_workspace_events](docs/sdks/events/README.md#search_workspace_events) - Search events for a particular workspace by any field\n<!-- End Available Resources and Operations [operations] -->\n\n\n\n\n\n\n\n<!-- Start Error Handling [errors] -->\n## Error Handling\n\nHandling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.\n\n| Error Object | Status Code | Content Type |\n| ---------------- | ---------------- | ---------------- |\n| errors.Error | 5XX | application/json |\n| errors.SDKError | 4xx-5xx | */* |\n\n### Example\n\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import errors, shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\nres = None\ntry:\n res = s.events.get_workspace_events_by_target(request={\n \"target_id\": \"<value>\",\n})\n\nexcept errors.Error as e:\n # handle exception\n raise(e)\nexcept errors.SDKError as e:\n # handle exception\n raise(e)\n\nif res.cli_event_batch is not None:\n # handle response\n pass\n\n```\n<!-- End Error Handling [errors] -->\n\n\n\n<!-- Start Server Selection [server] -->\n## Server Selection\n\n### Select Server by Name\n\nYou can override the default server globally by passing a server name to the `server: str` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:\n\n| Name | Server | Variables |\n| ----- | ------ | --------- |\n| `prod` | `https://api.prod.speakeasyapi.dev` | None |\n\n#### Example\n\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n server=\"prod\",\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.delete_api(request={\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n})\n\nif res is not None:\n # handle response\n pass\n\n```\n\n\n### Override Server URL Per-Client\n\nThe default server can also be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n server_url=\"https://api.prod.speakeasyapi.dev\",\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.delete_api(request={\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n})\n\nif res is not None:\n # handle response\n pass\n\n```\n<!-- End Server Selection [server] -->\n\n\n\n<!-- Start Custom HTTP Client [http-client] -->\n## Custom HTTP Client\n\nThe Python SDK makes API calls using the [httpx](https://www.python-httpx.org/) HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with your own HTTP client instance.\nDepending on whether you are using the sync or async version of the SDK, you can pass an instance of `HttpClient` or `AsyncHttpClient` respectively, which are Protocol's ensuring that the client has the necessary methods to make API calls.\nThis allows you to wrap the client with your own custom logic, such as adding custom headers, logging, or error handling, or you can just pass an instance of `httpx.Client` or `httpx.AsyncClient` directly.\n\nFor example, you could specify a header for every request that this sdk makes as follows:\n```python\nfrom speakeasy_client_sdk_python import Speakeasy\nimport httpx\n\nhttp_client = httpx.Client(headers={\"x-custom-header\": \"someValue\"})\ns = Speakeasy(client=http_client)\n```\n\nor you could wrap the client with your own custom logic:\n```python\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.httpclient import AsyncHttpClient\nimport httpx\n\nclass CustomClient(AsyncHttpClient):\n client: AsyncHttpClient\n\n def __init__(self, client: AsyncHttpClient):\n self.client = client\n\n async def send(\n self,\n request: httpx.Request,\n *,\n stream: bool = False,\n auth: Union[\n httpx._types.AuthTypes, httpx._client.UseClientDefault, None\n ] = httpx.USE_CLIENT_DEFAULT,\n follow_redirects: Union[\n bool, httpx._client.UseClientDefault\n ] = httpx.USE_CLIENT_DEFAULT,\n ) -> httpx.Response:\n request.headers[\"Client-Level-Header\"] = \"added by client\"\n\n return await self.client.send(\n request, stream=stream, auth=auth, follow_redirects=follow_redirects\n )\n\n def build_request(\n self,\n method: str,\n url: httpx._types.URLTypes,\n *,\n content: Optional[httpx._types.RequestContent] = None,\n data: Optional[httpx._types.RequestData] = None,\n files: Optional[httpx._types.RequestFiles] = None,\n json: Optional[Any] = None,\n params: Optional[httpx._types.QueryParamTypes] = None,\n headers: Optional[httpx._types.HeaderTypes] = None,\n cookies: Optional[httpx._types.CookieTypes] = None,\n timeout: Union[\n httpx._types.TimeoutTypes, httpx._client.UseClientDefault\n ] = httpx.USE_CLIENT_DEFAULT,\n extensions: Optional[httpx._types.RequestExtensions] = None,\n ) -> httpx.Request:\n return self.client.build_request(\n method,\n url,\n content=content,\n data=data,\n files=files,\n json=json,\n params=params,\n headers=headers,\n cookies=cookies,\n timeout=timeout,\n extensions=extensions,\n )\n\ns = Speakeasy(async_client=CustomClient(httpx.AsyncClient()))\n```\n<!-- End Custom HTTP Client [http-client] -->\n\n\n\n<!-- Start Authentication [security] -->\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security schemes globally:\n\n| Name | Type | Scheme |\n| ----------- | ----------- | ----------- |\n| `api_key` | apiKey | API key |\n| `bearer` | http | HTTP Bearer |\n\nYou can set the security parameters through the `security` optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.delete_api(request={\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n})\n\nif res is not None:\n # handle response\n pass\n\n```\n<!-- End Authentication [security] -->\n\n<!-- Start Global Parameters [global-parameters] -->\n## Global Parameters\n\nA parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.\n\nFor example, you can set `workspaceID` to `\"<value>\"` at SDK initialization and then you do not have to pass the same value on calls to operations like `get_workspace`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.\n\n\n### Available Globals\n\nThe following global parameter is available.\n\n| Name | Type | Required | Description |\n| ---- | ---- |:--------:| ----------- |\n| workspace_id | str | | The workspace_id parameter. |\n\n\n### Example\n\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.workspaces.get_workspace()\n\nif res.workspace is not None:\n # handle response\n pass\n\n```\n<!-- End Global Parameters [global-parameters] -->\n\n<!-- Start Retries [retries] -->\n## Retries\n\nSome of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.\n\nTo change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:\n```python\nimport os\nfrom speakeasy.utils import BackoffStrategy, RetryConfig\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.delete_api(request={\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n},\n RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False))\n\nif res is not None:\n # handle response\n pass\n\n```\n\nIf you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:\n```python\nimport os\nfrom speakeasy.utils import BackoffStrategy, RetryConfig\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n retry_config=RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False),\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.apis.delete_api(request={\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n})\n\nif res is not None:\n # handle response\n pass\n\n```\n<!-- End Retries [retries] -->\n\n<!-- Start File uploads [file-upload] -->\n## File uploads\n\nCertain SDK methods accept file objects as part of a request body or multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.\n\n> [!TIP]\n>\n> For endpoints that handle file uploads bytes arrays can also be used. However, using streams is recommended for large files.\n>\n\n```python\nimport os\nfrom speakeasy_client_sdk_python import Speakeasy\nfrom speakeasy_client_sdk_python.models import shared\n\ns = Speakeasy(\n security=shared.Security(\n api_key=os.getenv(\"API_KEY\", \"\"),\n ),\n)\n\n\nres = s.schemas.register_schema(request={\n \"request_body\": {\n \"file\": {\n \"content\": open(\"<file_path>\", \"rb\"),\n \"file_name\": \"your_file_here\",\n },\n },\n \"api_id\": \"<value>\",\n \"version_id\": \"<value>\",\n})\n\nif res is not None:\n # handle response\n pass\n\n```\n<!-- End File uploads [file-upload] -->\n\n<!-- Placeholder for Future Speakeasy SDK Sections -->\n\n\n\n### SDK Generated by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)\n",
"bugtrack_url": null,
"license": null,
"summary": "Speakeasy API Client SDK for Python",
"version": "6.3.0",
"project_urls": {
"Homepage": "https://github.com/speakeasy-api/speakeasy-client-sdk-python.git",
"Repository": "https://github.com/speakeasy-api/speakeasy-client-sdk-python.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d531a7524c12781f4c89703f9271e4e20a0b4c992ce83a2d326a1ae4c43c10b8",
"md5": "25415556ddc15ec18e5b041f0ea1d45e",
"sha256": "4bd6963081d4fe5e8416349c55acfe3857ca702526f6dd89e352f1960b74add9"
},
"downloads": -1,
"filename": "speakeasy_client_sdk_python-6.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "25415556ddc15ec18e5b041f0ea1d45e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 166159,
"upload_time": "2024-07-27T00:13:30",
"upload_time_iso_8601": "2024-07-27T00:13:30.901186Z",
"url": "https://files.pythonhosted.org/packages/d5/31/a7524c12781f4c89703f9271e4e20a0b4c992ce83a2d326a1ae4c43c10b8/speakeasy_client_sdk_python-6.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "af044330b40a721943c265ed9da2b234d7a8717fcb6ce287cc3d3cc334975f6f",
"md5": "eb9fb5375740a5cd986643dfbc904bae",
"sha256": "55ddf4788aeafd5697e02b88736e8d54369c4a083f63417592e234784d8a0baa"
},
"downloads": -1,
"filename": "speakeasy_client_sdk_python-6.3.0.tar.gz",
"has_sig": false,
"md5_digest": "eb9fb5375740a5cd986643dfbc904bae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 71816,
"upload_time": "2024-07-27T00:13:36",
"upload_time_iso_8601": "2024-07-27T00:13:36.672320Z",
"url": "https://files.pythonhosted.org/packages/af/04/4330b40a721943c265ed9da2b234d7a8717fcb6ce287cc3d3cc334975f6f/speakeasy_client_sdk_python-6.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-27 00:13:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "speakeasy-api",
"github_project": "speakeasy-client-sdk-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "speakeasy-client-sdk-python"
}