mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.476.0
This commit is contained in:
31
README.md
31
README.md
@@ -54,6 +54,7 @@ The following SDKs are generated from the OpenAPI Specification. They are automa
|
||||
* [Server Selection](#server-selection)
|
||||
* [Custom HTTP Client](#custom-http-client)
|
||||
* [Authentication](#authentication)
|
||||
* [Resource Management](#resource-management)
|
||||
* [Debugging](#debugging)
|
||||
* [Development](#development)
|
||||
* [Maturity](#maturity)
|
||||
@@ -64,6 +65,11 @@ The following SDKs are generated from the OpenAPI Specification. They are automa
|
||||
<!-- Start SDK Installation [installation] -->
|
||||
## SDK Installation
|
||||
|
||||
> [!NOTE]
|
||||
> **Python version upgrade policy**
|
||||
>
|
||||
> Once a Python version reaches its [official end of life date](https://devguide.python.org/versions/), a 3-month grace period is provided for users to upgrade. Following this grace period, the minimum python version supported in the SDK will be updated.
|
||||
|
||||
The SDK can be installed with either *pip* or *poetry* package managers.
|
||||
|
||||
### PIP
|
||||
@@ -529,6 +535,31 @@ with PlexAPI(
|
||||
```
|
||||
<!-- End Authentication [security] -->
|
||||
|
||||
<!-- Start Resource Management [resource-management] -->
|
||||
## Resource Management
|
||||
|
||||
The `PlexAPI` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
||||
|
||||
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
||||
|
||||
```python
|
||||
from plex_api_client import PlexAPI
|
||||
def main():
|
||||
with PlexAPI(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
) as plex_api:
|
||||
# Rest of application here...
|
||||
|
||||
|
||||
# Or when using async:
|
||||
async def amain():
|
||||
async with PlexAPI(
|
||||
access_token="<YOUR_API_KEY_HERE>",
|
||||
) as plex_api:
|
||||
# Rest of application here...
|
||||
```
|
||||
<!-- End Resource Management [resource-management] -->
|
||||
|
||||
<!-- Start Debugging [debug] -->
|
||||
## Debugging
|
||||
|
||||
|
||||
Reference in New Issue
Block a user