plex-api-client


Nameplex-api-client JSON
Version 0.20.0 PyPI version JSON
download
home_pagehttps://github.com/LukeHagar/plexpy.git
SummaryPython Client SDK Generated by Speakeasy
upload_time2024-12-21 00:04:24
maintainerNone
docs_urlNone
authorSpeakeasy
requires_python<4.0,>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # plexpy

<div align="left">
    <a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
    <a href="https://opensource.org/licenses/MIT">
        <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
    </a>
</div>

<!-- Start Summary [summary] -->
## Summary

Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server

# Plex Media Server OpenAPI Specification

An Open Source OpenAPI Specification for Plex Media Server

Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)

## Documentation

[API Documentation](https://plexapi.dev)

## SDKs

The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the [main specification Repository](https://github.com/LukeHagar/plex-api-spec).

| Language              | Repository                                        | Releases                                                                                         | Other                                                   |
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
| Python                | [GitHub](https://github.com/LukeHagar/plexpy)     | [PyPI](https://pypi.org/project/plex-api-client/)                                                | -                                                       |
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs)     | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | -                                                       |
| Go                    | [GitHub](https://github.com/LukeHagar/plexgo)     | [Releases](https://github.com/LukeHagar/plexgo/releases)                                         | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
| Ruby                  | [GitHub](https://github.com/LukeHagar/plexruby)   | [Releases](https://github.com/LukeHagar/plexruby/releases)                                       | -                                                       |
| Swift                 | [GitHub](https://github.com/LukeHagar/plexswift)  | [Releases](https://github.com/LukeHagar/plexswift/releases)                                      | -                                                       |
| PHP                   | [GitHub](https://github.com/LukeHagar/plexphp)    | [Releases](https://github.com/LukeHagar/plexphp/releases)                                        | -                                                       |
| Java                  | [GitHub](https://github.com/LukeHagar/plexjava)   | [Releases](https://github.com/LukeHagar/plexjava/releases)                                       | -                                                       |
| C#                    | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases)                                     | -
<!-- End Summary [summary] -->

<!-- Start Table of Contents [toc] -->
## Table of Contents
<!-- $toc-max-depth=2 -->
* [plexpy](https://github.com/LukeHagar/plexpy/blob/master/#plexpy)
* [Plex Media Server OpenAPI Specification](https://github.com/LukeHagar/plexpy/blob/master/#plex-media-server-openapi-specification)
  * [Documentation](https://github.com/LukeHagar/plexpy/blob/master/#documentation)
  * [SDKs](https://github.com/LukeHagar/plexpy/blob/master/#sdks)
  * [SDK Installation](https://github.com/LukeHagar/plexpy/blob/master/#sdk-installation)
  * [IDE Support](https://github.com/LukeHagar/plexpy/blob/master/#ide-support)
  * [SDK Example Usage](https://github.com/LukeHagar/plexpy/blob/master/#sdk-example-usage)
  * [Available Resources and Operations](https://github.com/LukeHagar/plexpy/blob/master/#available-resources-and-operations)
  * [Retries](https://github.com/LukeHagar/plexpy/blob/master/#retries)
  * [Error Handling](https://github.com/LukeHagar/plexpy/blob/master/#error-handling)
  * [Server Selection](https://github.com/LukeHagar/plexpy/blob/master/#server-selection)
  * [Custom HTTP Client](https://github.com/LukeHagar/plexpy/blob/master/#custom-http-client)
  * [Authentication](https://github.com/LukeHagar/plexpy/blob/master/#authentication)
  * [Debugging](https://github.com/LukeHagar/plexpy/blob/master/#debugging)
* [Development](https://github.com/LukeHagar/plexpy/blob/master/#development)
  * [Maturity](https://github.com/LukeHagar/plexpy/blob/master/#maturity)
  * [Contributions](https://github.com/LukeHagar/plexpy/blob/master/#contributions)

<!-- End Table of Contents [toc] -->

<!-- Start SDK Installation [installation] -->
## SDK Installation

The SDK can be installed with either *pip* or *poetry* package managers.

### PIP

*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.

```bash
pip install plex-api-client
```

### Poetry

*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.

```bash
poetry add plex-api-client
```
<!-- End SDK Installation [installation] -->

<!-- Start IDE Support [idesupport] -->
## IDE Support

### PyCharm

Generally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.

- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)
<!-- End IDE Support [idesupport] -->

<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage

### Example

```python
# Synchronous Example
from plex_api_client import PlexAPI

with PlexAPI(
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.server.get_server_capabilities()

    assert res.object is not None

    # Handle response
    print(res.object)
```

</br>

The same SDK client can also be used to make asychronous requests by importing asyncio.
```python
# Asynchronous Example
import asyncio
from plex_api_client import PlexAPI

async def main():
    async with PlexAPI(
        access_token="<YOUR_API_KEY_HERE>",
    ) as plex_api:

        res = await plex_api.server.get_server_capabilities_async()

        assert res.object is not None

        # Handle response
        print(res.object)

asyncio.run(main())
```
<!-- End SDK Example Usage [usage] -->

<!-- Start Available Resources and Operations [operations] -->
## Available Resources and Operations

<details open>
<summary>Available methods</summary>

### [activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md)

* [get_server_activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md#get_server_activities) - Get Server Activities
* [cancel_server_activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md#cancel_server_activities) - Cancel Server Activities

### [authentication](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md)

* [get_transient_token](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_transient_token) - Get a Transient Token
* [get_source_connection_information](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_source_connection_information) - Get Source Connection Information
* [get_token_details](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_token_details) - Get Token Details
* [post_users_sign_in_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#post_users_sign_in_data) - Get User Sign In Data

### [butler](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md)

* [get_butler_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#get_butler_tasks) - Get Butler tasks
* [start_all_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#start_all_tasks) - Start all Butler tasks
* [stop_all_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#stop_all_tasks) - Stop all Butler tasks
* [start_task](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#start_task) - Start a single Butler task
* [stop_task](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#stop_task) - Stop a single Butler task

### [hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md)

* [get_global_hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_global_hubs) - Get Global Hubs
* [get_recently_added](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_recently_added) - Get Recently Added
* [get_library_hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_library_hubs) - Get library specific hubs

### [library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md)

* [get_file_hash](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_file_hash) - Get Hash Value
* [get_recently_added_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_recently_added_library) - Get Recently Added
* [get_all_libraries](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_all_libraries) - Get All Libraries
* [get_library_details](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_library_details) - Get Library Details
* [delete_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#delete_library) - Delete Library Section
* [get_library_items](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_library_items) - Get Library Items
* [get_refresh_library_metadata](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_refresh_library_metadata) - Refresh Metadata Of The Library
* [get_search_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_search_library) - Search Library
* [get_search_all_libraries](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_search_all_libraries) - Search All Libraries
* [get_meta_data_by_rating_key](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_meta_data_by_rating_key) - Get Metadata by RatingKey
* [get_metadata_children](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_metadata_children) - Get Items Children
* [get_top_watched_content](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_top_watched_content) - Get Top Watched Content
* [get_on_deck](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_on_deck) - Get On Deck

### [log](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md)

* [log_line](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#log_line) - Logging a single line message.
* [log_multi_line](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#log_multi_line) - Logging a multi-line message
* [enable_paper_trail](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#enable_paper_trail) - Enabling Papertrail

### [media](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md)

* [mark_played](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#mark_played) - Mark Media Played
* [mark_unplayed](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#mark_unplayed) - Mark Media Unplayed
* [update_play_progress](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#update_play_progress) - Update Media Play Progress
* [get_banner_image](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#get_banner_image) - Get Banner Image
* [get_thumb_image](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#get_thumb_image) - Get Thumb Image

### [playlists](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md)

* [create_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#create_playlist) - Create a Playlist
* [get_playlists](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlists) - Get All Playlists
* [get_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlist) - Retrieve Playlist
* [delete_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#delete_playlist) - Deletes a Playlist
* [update_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#update_playlist) - Update a Playlist
* [get_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlist_contents) - Retrieve Playlist Contents
* [clear_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#clear_playlist_contents) - Delete Playlist Contents
* [add_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#add_playlist_contents) - Adding to a Playlist
* [upload_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#upload_playlist) - Upload Playlist

### [plex](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md)

* [get_companions_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_companions_data) - Get Companions Data
* [get_user_friends](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_user_friends) - Get list of friends of the user logged in
* [get_geo_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_geo_data) - Get Geo Data
* [get_home_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_home_data) - Get Plex Home Data
* [get_server_resources](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_server_resources) - Get Server Resources
* [get_pin](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_pin) - Get a Pin
* [get_token_by_pin_id](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_token_by_pin_id) - Get Access Token by PinId


### [search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md)

* [perform_search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#perform_search) - Perform a search
* [perform_voice_search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#perform_voice_search) - Perform a voice search
* [get_search_results](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#get_search_results) - Get Search Results

### [server](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md)

* [get_server_capabilities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_capabilities) - Get Server Capabilities
* [get_server_preferences](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_preferences) - Get Server Preferences
* [get_available_clients](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_available_clients) - Get Available Clients
* [get_devices](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_devices) - Get Devices
* [get_server_identity](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_identity) - Get Server Identity
* [get_my_plex_account](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_my_plex_account) - Get MyPlex Account
* [get_resized_photo](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_resized_photo) - Get a Resized Photo
* [get_media_providers](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_media_providers) - Get Media Providers
* [get_server_list](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_list) - Get Server List

### [sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md)

* [get_sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_sessions) - Get Active Sessions
* [get_session_history](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_session_history) - Get Session History
* [get_transcode_sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_transcode_sessions) - Get Transcode Sessions
* [stop_transcode_session](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#stop_transcode_session) - Stop a Transcode Session

### [statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md)

* [get_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_statistics) - Get Media Statistics
* [get_resources_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_resources_statistics) - Get Resources Statistics
* [get_bandwidth_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_bandwidth_statistics) - Get Bandwidth Statistics

### [updater](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md)

* [get_update_status](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#get_update_status) - Querying status of updates
* [check_for_updates](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#check_for_updates) - Checking for updates
* [apply_updates](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#apply_updates) - Apply Updates

### [video](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md)

* [get_timeline](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md#get_timeline) - Get the timeline for a media item
* [start_universal_transcode](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md#start_universal_transcode) - Start Universal Transcode

### [watchlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/watchlist/README.md)

* [get_watch_list](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/watchlist/README.md#get_watch_list) - Get User Watchlist

</details>
<!-- End Available Resources and Operations [operations] -->

<!-- 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
from plex_api_client import PlexAPI
from plex_api_client.utils import BackoffStrategy, RetryConfig

with PlexAPI(
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.server.get_server_capabilities(,
        RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))

    assert res.object is not None

    # Handle response
    print(res.object)

```

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
from plex_api_client import PlexAPI
from plex_api_client.utils import BackoffStrategy, RetryConfig

with PlexAPI(
    retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.server.get_server_capabilities()

    assert res.object is not None

    # Handle response
    print(res.object)

```
<!-- End Retries [retries] -->

<!-- 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 exception.

By default, an API error will raise a errors.SDKError exception, which has the following properties:

| Property        | Type             | Description           |
|-----------------|------------------|-----------------------|
| `.status_code`  | *int*            | The HTTP status code  |
| `.message`      | *str*            | The error message     |
| `.raw_response` | *httpx.Response* | The raw HTTP response |
| `.body`         | *str*            | The response content  |

When custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get_server_capabilities_async` method may raise the following exceptions:

| Error Type                               | Status Code | Content Type     |
| ---------------------------------------- | ----------- | ---------------- |
| errors.GetServerCapabilitiesBadRequest   | 400         | application/json |
| errors.GetServerCapabilitiesUnauthorized | 401         | application/json |
| errors.SDKError                          | 4XX, 5XX    | \*/\*            |

### Example

```python
from plex_api_client import PlexAPI
from plex_api_client.models import errors

with PlexAPI(
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:
    res = None
    try:

        res = plex_api.server.get_server_capabilities()

        assert res.object is not None

        # Handle response
        print(res.object)

    except errors.GetServerCapabilitiesBadRequest as e:
        # handle e.data: errors.GetServerCapabilitiesBadRequestData
        raise(e)
    except errors.GetServerCapabilitiesUnauthorized as e:
        # handle e.data: errors.GetServerCapabilitiesUnauthorizedData
        raise(e)
    except errors.SDKError as e:
        # handle exception
        raise(e)
```
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
## Server Selection

### Server Variables

The default server `{protocol}://{ip}:{port}` contains variables and is set to `https://10.10.10.47:32400` by default. To override default values, the following parameters are available when initializing the SDK client instance:
 * `protocol: models.ServerProtocol`
 * `ip: str`
 * `port: str`

### 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
from plex_api_client import PlexAPI

with PlexAPI(
    server_url="https://10.10.10.47:32400",
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.server.get_server_capabilities()

    assert res.object is not None

    # Handle response
    print(res.object)

```

### Override Server URL Per-Operation

The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
```python
from plex_api_client import PlexAPI

with PlexAPI(
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.plex.get_companions_data(server_url="https://plex.tv/api/v2")

    assert res.response_bodies is not None

    # Handle response
    print(res.response_bodies)

```
<!-- 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 plex_api_client import PlexAPI
import httpx

http_client = httpx.Client(headers={"x-custom-header": "someValue"})
s = PlexAPI(client=http_client)
```

or you could wrap the client with your own custom logic:
```python
from plex_api_client import PlexAPI
from plex_api_client.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 = PlexAPI(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 scheme globally:

| Name           | Type   | Scheme  |
| -------------- | ------ | ------- |
| `access_token` | apiKey | API key |

To authenticate with the API the `access_token` parameter must be set when initializing the SDK client instance. For example:
```python
from plex_api_client import PlexAPI

with PlexAPI(
    access_token="<YOUR_API_KEY_HERE>",
) as plex_api:

    res = plex_api.server.get_server_capabilities()

    assert res.object is not None

    # Handle response
    print(res.object)

```
<!-- End Authentication [security] -->

<!-- Start Debugging [debug] -->
## Debugging

You can setup your SDK to emit debug logs for SDK requests and responses.

You can pass your own logger class directly into your SDK.
```python
from plex_api_client import PlexAPI
import logging

logging.basicConfig(level=logging.DEBUG)
s = PlexAPI(debug_logger=logging.getLogger("plex_api_client"))
```
<!-- End Debugging [debug] -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

# Development

## Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
looking for the latest version.

## Contributions

While we value open-source contributions to this SDK, this library is generated programmatically.
Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LukeHagar/plexpy.git",
    "name": "plex-api-client",
    "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/47/4a/d25b5b5a53b1f432411516ed368c52f01d25942ad2158b47d050a4a22094/plex_api_client-0.20.0.tar.gz",
    "platform": null,
    "description": "# plexpy\n\n<div align=\"left\">\n    <a href=\"https://speakeasyapi.dev/\"><img src=\"https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454\" /></a>\n    <a href=\"https://opensource.org/licenses/MIT\">\n        <img src=\"https://img.shields.io/badge/License-MIT-blue.svg\" style=\"width: 100px; height: 28px;\" />\n    </a>\n</div>\n\n<!-- Start Summary [summary] -->\n## Summary\n\nPlex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server\n\n# Plex Media Server OpenAPI Specification\n\nAn Open Source OpenAPI Specification for Plex Media Server\n\nAutomation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)\n\n## Documentation\n\n[API Documentation](https://plexapi.dev)\n\n## SDKs\n\nThe following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the [main specification Repository](https://github.com/LukeHagar/plex-api-spec).\n\n| Language              | Repository                                        | Releases                                                                                         | Other                                                   |\n| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |\n| Python                | [GitHub](https://github.com/LukeHagar/plexpy)     | [PyPI](https://pypi.org/project/plex-api-client/)                                                | -                                                       |\n| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs)     | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \\ [JSR](https://jsr.io/@lukehagar/plexjs) | -                                                       |\n| Go                    | [GitHub](https://github.com/LukeHagar/plexgo)     | [Releases](https://github.com/LukeHagar/plexgo/releases)                                         | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |\n| Ruby                  | [GitHub](https://github.com/LukeHagar/plexruby)   | [Releases](https://github.com/LukeHagar/plexruby/releases)                                       | -                                                       |\n| Swift                 | [GitHub](https://github.com/LukeHagar/plexswift)  | [Releases](https://github.com/LukeHagar/plexswift/releases)                                      | -                                                       |\n| PHP                   | [GitHub](https://github.com/LukeHagar/plexphp)    | [Releases](https://github.com/LukeHagar/plexphp/releases)                                        | -                                                       |\n| Java                  | [GitHub](https://github.com/LukeHagar/plexjava)   | [Releases](https://github.com/LukeHagar/plexjava/releases)                                       | -                                                       |\n| C#                    | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases)                                     | -\n<!-- End Summary [summary] -->\n\n<!-- Start Table of Contents [toc] -->\n## Table of Contents\n<!-- $toc-max-depth=2 -->\n* [plexpy](https://github.com/LukeHagar/plexpy/blob/master/#plexpy)\n* [Plex Media Server OpenAPI Specification](https://github.com/LukeHagar/plexpy/blob/master/#plex-media-server-openapi-specification)\n  * [Documentation](https://github.com/LukeHagar/plexpy/blob/master/#documentation)\n  * [SDKs](https://github.com/LukeHagar/plexpy/blob/master/#sdks)\n  * [SDK Installation](https://github.com/LukeHagar/plexpy/blob/master/#sdk-installation)\n  * [IDE Support](https://github.com/LukeHagar/plexpy/blob/master/#ide-support)\n  * [SDK Example Usage](https://github.com/LukeHagar/plexpy/blob/master/#sdk-example-usage)\n  * [Available Resources and Operations](https://github.com/LukeHagar/plexpy/blob/master/#available-resources-and-operations)\n  * [Retries](https://github.com/LukeHagar/plexpy/blob/master/#retries)\n  * [Error Handling](https://github.com/LukeHagar/plexpy/blob/master/#error-handling)\n  * [Server Selection](https://github.com/LukeHagar/plexpy/blob/master/#server-selection)\n  * [Custom HTTP Client](https://github.com/LukeHagar/plexpy/blob/master/#custom-http-client)\n  * [Authentication](https://github.com/LukeHagar/plexpy/blob/master/#authentication)\n  * [Debugging](https://github.com/LukeHagar/plexpy/blob/master/#debugging)\n* [Development](https://github.com/LukeHagar/plexpy/blob/master/#development)\n  * [Maturity](https://github.com/LukeHagar/plexpy/blob/master/#maturity)\n  * [Contributions](https://github.com/LukeHagar/plexpy/blob/master/#contributions)\n\n<!-- End Table of Contents [toc] -->\n\n<!-- Start SDK Installation [installation] -->\n## SDK Installation\n\nThe SDK can be installed with either *pip* or *poetry* package managers.\n\n### PIP\n\n*PIP* is the default package installer for Python, enabling easy installation and management of packages from PyPI via the command line.\n\n```bash\npip install plex-api-client\n```\n\n### Poetry\n\n*Poetry* is a modern tool that simplifies dependency management and package publishing by using a single `pyproject.toml` file to handle project metadata and dependencies.\n\n```bash\npoetry add plex-api-client\n```\n<!-- End SDK Installation [installation] -->\n\n<!-- Start IDE Support [idesupport] -->\n## IDE Support\n\n### PyCharm\n\nGenerally, the SDK will work well with most IDEs out of the box. However, when using PyCharm, you can enjoy much better integration with Pydantic by installing an additional plugin.\n\n- [PyCharm Pydantic Plugin](https://docs.pydantic.dev/latest/integrations/pycharm/)\n<!-- End IDE Support [idesupport] -->\n\n<!-- Start SDK Example Usage [usage] -->\n## SDK Example Usage\n\n### Example\n\n```python\n# Synchronous Example\nfrom plex_api_client import PlexAPI\n\nwith PlexAPI(\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.server.get_server_capabilities()\n\n    assert res.object is not None\n\n    # Handle response\n    print(res.object)\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\nfrom plex_api_client import PlexAPI\n\nasync def main():\n    async with PlexAPI(\n        access_token=\"<YOUR_API_KEY_HERE>\",\n    ) as plex_api:\n\n        res = await plex_api.server.get_server_capabilities_async()\n\n        assert res.object is not None\n\n        # Handle response\n        print(res.object)\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<details open>\n<summary>Available methods</summary>\n\n### [activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md)\n\n* [get_server_activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md#get_server_activities) - Get Server Activities\n* [cancel_server_activities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/activities/README.md#cancel_server_activities) - Cancel Server Activities\n\n### [authentication](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md)\n\n* [get_transient_token](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_transient_token) - Get a Transient Token\n* [get_source_connection_information](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_source_connection_information) - Get Source Connection Information\n* [get_token_details](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#get_token_details) - Get Token Details\n* [post_users_sign_in_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/authentication/README.md#post_users_sign_in_data) - Get User Sign In Data\n\n### [butler](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md)\n\n* [get_butler_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#get_butler_tasks) - Get Butler tasks\n* [start_all_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#start_all_tasks) - Start all Butler tasks\n* [stop_all_tasks](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#stop_all_tasks) - Stop all Butler tasks\n* [start_task](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#start_task) - Start a single Butler task\n* [stop_task](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/butler/README.md#stop_task) - Stop a single Butler task\n\n### [hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md)\n\n* [get_global_hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_global_hubs) - Get Global Hubs\n* [get_recently_added](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_recently_added) - Get Recently Added\n* [get_library_hubs](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/hubs/README.md#get_library_hubs) - Get library specific hubs\n\n### [library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md)\n\n* [get_file_hash](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_file_hash) - Get Hash Value\n* [get_recently_added_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_recently_added_library) - Get Recently Added\n* [get_all_libraries](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_all_libraries) - Get All Libraries\n* [get_library_details](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_library_details) - Get Library Details\n* [delete_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#delete_library) - Delete Library Section\n* [get_library_items](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_library_items) - Get Library Items\n* [get_refresh_library_metadata](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_refresh_library_metadata) - Refresh Metadata Of The Library\n* [get_search_library](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_search_library) - Search Library\n* [get_search_all_libraries](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_search_all_libraries) - Search All Libraries\n* [get_meta_data_by_rating_key](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_meta_data_by_rating_key) - Get Metadata by RatingKey\n* [get_metadata_children](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_metadata_children) - Get Items Children\n* [get_top_watched_content](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_top_watched_content) - Get Top Watched Content\n* [get_on_deck](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/library/README.md#get_on_deck) - Get On Deck\n\n### [log](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md)\n\n* [log_line](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#log_line) - Logging a single line message.\n* [log_multi_line](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#log_multi_line) - Logging a multi-line message\n* [enable_paper_trail](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/log/README.md#enable_paper_trail) - Enabling Papertrail\n\n### [media](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md)\n\n* [mark_played](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#mark_played) - Mark Media Played\n* [mark_unplayed](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#mark_unplayed) - Mark Media Unplayed\n* [update_play_progress](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#update_play_progress) - Update Media Play Progress\n* [get_banner_image](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#get_banner_image) - Get Banner Image\n* [get_thumb_image](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/media/README.md#get_thumb_image) - Get Thumb Image\n\n### [playlists](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md)\n\n* [create_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#create_playlist) - Create a Playlist\n* [get_playlists](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlists) - Get All Playlists\n* [get_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlist) - Retrieve Playlist\n* [delete_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#delete_playlist) - Deletes a Playlist\n* [update_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#update_playlist) - Update a Playlist\n* [get_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#get_playlist_contents) - Retrieve Playlist Contents\n* [clear_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#clear_playlist_contents) - Delete Playlist Contents\n* [add_playlist_contents](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#add_playlist_contents) - Adding to a Playlist\n* [upload_playlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/playlists/README.md#upload_playlist) - Upload Playlist\n\n### [plex](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md)\n\n* [get_companions_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_companions_data) - Get Companions Data\n* [get_user_friends](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_user_friends) - Get list of friends of the user logged in\n* [get_geo_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_geo_data) - Get Geo Data\n* [get_home_data](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_home_data) - Get Plex Home Data\n* [get_server_resources](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_server_resources) - Get Server Resources\n* [get_pin](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_pin) - Get a Pin\n* [get_token_by_pin_id](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/plex/README.md#get_token_by_pin_id) - Get Access Token by PinId\n\n\n### [search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md)\n\n* [perform_search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#perform_search) - Perform a search\n* [perform_voice_search](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#perform_voice_search) - Perform a voice search\n* [get_search_results](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/search/README.md#get_search_results) - Get Search Results\n\n### [server](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md)\n\n* [get_server_capabilities](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_capabilities) - Get Server Capabilities\n* [get_server_preferences](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_preferences) - Get Server Preferences\n* [get_available_clients](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_available_clients) - Get Available Clients\n* [get_devices](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_devices) - Get Devices\n* [get_server_identity](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_identity) - Get Server Identity\n* [get_my_plex_account](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_my_plex_account) - Get MyPlex Account\n* [get_resized_photo](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_resized_photo) - Get a Resized Photo\n* [get_media_providers](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_media_providers) - Get Media Providers\n* [get_server_list](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/server/README.md#get_server_list) - Get Server List\n\n### [sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md)\n\n* [get_sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_sessions) - Get Active Sessions\n* [get_session_history](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_session_history) - Get Session History\n* [get_transcode_sessions](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#get_transcode_sessions) - Get Transcode Sessions\n* [stop_transcode_session](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/sessions/README.md#stop_transcode_session) - Stop a Transcode Session\n\n### [statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md)\n\n* [get_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_statistics) - Get Media Statistics\n* [get_resources_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_resources_statistics) - Get Resources Statistics\n* [get_bandwidth_statistics](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/statistics/README.md#get_bandwidth_statistics) - Get Bandwidth Statistics\n\n### [updater](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md)\n\n* [get_update_status](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#get_update_status) - Querying status of updates\n* [check_for_updates](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#check_for_updates) - Checking for updates\n* [apply_updates](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/updater/README.md#apply_updates) - Apply Updates\n\n### [video](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md)\n\n* [get_timeline](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md#get_timeline) - Get the timeline for a media item\n* [start_universal_transcode](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/video/README.md#start_universal_transcode) - Start Universal Transcode\n\n### [watchlist](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/watchlist/README.md)\n\n* [get_watch_list](https://github.com/LukeHagar/plexpy/blob/master/docs/sdks/watchlist/README.md#get_watch_list) - Get User Watchlist\n\n</details>\n<!-- End Available Resources and Operations [operations] -->\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\nfrom plex_api_client import PlexAPI\nfrom plex_api_client.utils import BackoffStrategy, RetryConfig\n\nwith PlexAPI(\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.server.get_server_capabilities(,\n        RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False))\n\n    assert res.object is not None\n\n    # Handle response\n    print(res.object)\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\nfrom plex_api_client import PlexAPI\nfrom plex_api_client.utils import BackoffStrategy, RetryConfig\n\nwith PlexAPI(\n    retry_config=RetryConfig(\"backoff\", BackoffStrategy(1, 50, 1.1, 100), False),\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.server.get_server_capabilities()\n\n    assert res.object is not None\n\n    # Handle response\n    print(res.object)\n\n```\n<!-- End Retries [retries] -->\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 exception.\n\nBy default, an API error will raise a errors.SDKError exception, which has the following properties:\n\n| Property        | Type             | Description           |\n|-----------------|------------------|-----------------------|\n| `.status_code`  | *int*            | The HTTP status code  |\n| `.message`      | *str*            | The error message     |\n| `.raw_response` | *httpx.Response* | The raw HTTP response |\n| `.body`         | *str*            | The response content  |\n\nWhen custom error responses are specified for an operation, the SDK may also raise their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `get_server_capabilities_async` method may raise the following exceptions:\n\n| Error Type                               | Status Code | Content Type     |\n| ---------------------------------------- | ----------- | ---------------- |\n| errors.GetServerCapabilitiesBadRequest   | 400         | application/json |\n| errors.GetServerCapabilitiesUnauthorized | 401         | application/json |\n| errors.SDKError                          | 4XX, 5XX    | \\*/\\*            |\n\n### Example\n\n```python\nfrom plex_api_client import PlexAPI\nfrom plex_api_client.models import errors\n\nwith PlexAPI(\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n    res = None\n    try:\n\n        res = plex_api.server.get_server_capabilities()\n\n        assert res.object is not None\n\n        # Handle response\n        print(res.object)\n\n    except errors.GetServerCapabilitiesBadRequest as e:\n        # handle e.data: errors.GetServerCapabilitiesBadRequestData\n        raise(e)\n    except errors.GetServerCapabilitiesUnauthorized as e:\n        # handle e.data: errors.GetServerCapabilitiesUnauthorizedData\n        raise(e)\n    except errors.SDKError as e:\n        # handle exception\n        raise(e)\n```\n<!-- End Error Handling [errors] -->\n\n<!-- Start Server Selection [server] -->\n## Server Selection\n\n### Server Variables\n\nThe default server `{protocol}://{ip}:{port}` contains variables and is set to `https://10.10.10.47:32400` by default. To override default values, the following parameters are available when initializing the SDK client instance:\n * `protocol: models.ServerProtocol`\n * `ip: str`\n * `port: str`\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\nfrom plex_api_client import PlexAPI\n\nwith PlexAPI(\n    server_url=\"https://10.10.10.47:32400\",\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.server.get_server_capabilities()\n\n    assert res.object is not None\n\n    # Handle response\n    print(res.object)\n\n```\n\n### Override Server URL Per-Operation\n\nThe server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:\n```python\nfrom plex_api_client import PlexAPI\n\nwith PlexAPI(\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.plex.get_companions_data(server_url=\"https://plex.tv/api/v2\")\n\n    assert res.response_bodies is not None\n\n    # Handle response\n    print(res.response_bodies)\n\n```\n<!-- End Server Selection [server] -->\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 plex_api_client import PlexAPI\nimport httpx\n\nhttp_client = httpx.Client(headers={\"x-custom-header\": \"someValue\"})\ns = PlexAPI(client=http_client)\n```\n\nor you could wrap the client with your own custom logic:\n```python\nfrom plex_api_client import PlexAPI\nfrom plex_api_client.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 = PlexAPI(async_client=CustomClient(httpx.AsyncClient()))\n```\n<!-- End Custom HTTP Client [http-client] -->\n\n<!-- Start Authentication [security] -->\n## Authentication\n\n### Per-Client Security Schemes\n\nThis SDK supports the following security scheme globally:\n\n| Name           | Type   | Scheme  |\n| -------------- | ------ | ------- |\n| `access_token` | apiKey | API key |\n\nTo authenticate with the API the `access_token` parameter must be set when initializing the SDK client instance. For example:\n```python\nfrom plex_api_client import PlexAPI\n\nwith PlexAPI(\n    access_token=\"<YOUR_API_KEY_HERE>\",\n) as plex_api:\n\n    res = plex_api.server.get_server_capabilities()\n\n    assert res.object is not None\n\n    # Handle response\n    print(res.object)\n\n```\n<!-- End Authentication [security] -->\n\n<!-- Start Debugging [debug] -->\n## Debugging\n\nYou can setup your SDK to emit debug logs for SDK requests and responses.\n\nYou can pass your own logger class directly into your SDK.\n```python\nfrom plex_api_client import PlexAPI\nimport logging\n\nlogging.basicConfig(level=logging.DEBUG)\ns = PlexAPI(debug_logger=logging.getLogger(\"plex_api_client\"))\n```\n<!-- End Debugging [debug] -->\n\n<!-- Placeholder for Future Speakeasy SDK Sections -->\n\n# Development\n\n## Maturity\n\nThis SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage\nto a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally\nlooking for the latest version.\n\n## Contributions\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nFeel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!\n\n### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python Client SDK Generated by Speakeasy",
    "version": "0.20.0",
    "project_urls": {
        "Homepage": "https://github.com/LukeHagar/plexpy.git",
        "Repository": "https://github.com/LukeHagar/plexpy.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b8a74d717123864dbee2b1430efd0f1412543fc29aaede1f405a72af90dbc5a2",
                "md5": "ee10e11f31a2b7918c7cbbf3462b7d41",
                "sha256": "0bf6a2eb9760d67acbbcc6dcfe49e147989822dd0dbdb7c48287b0dac90a3ce1"
            },
            "downloads": -1,
            "filename": "plex_api_client-0.20.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ee10e11f31a2b7918c7cbbf3462b7d41",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 272672,
            "upload_time": "2024-12-21T00:04:21",
            "upload_time_iso_8601": "2024-12-21T00:04:21.664618Z",
            "url": "https://files.pythonhosted.org/packages/b8/a7/4d717123864dbee2b1430efd0f1412543fc29aaede1f405a72af90dbc5a2/plex_api_client-0.20.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "474ad25b5b5a53b1f432411516ed368c52f01d25942ad2158b47d050a4a22094",
                "md5": "aa8408061abefc7bef1e89b9ba6f63ae",
                "sha256": "5dbe7125bd1dd641b6084288ec273b687f2fd63803958af321ce4f6248be4dcb"
            },
            "downloads": -1,
            "filename": "plex_api_client-0.20.0.tar.gz",
            "has_sig": false,
            "md5_digest": "aa8408061abefc7bef1e89b9ba6f63ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 145624,
            "upload_time": "2024-12-21T00:04:24",
            "upload_time_iso_8601": "2024-12-21T00:04:24.167664Z",
            "url": "https://files.pythonhosted.org/packages/47/4a/d25b5b5a53b1f432411516ed368c52f01d25942ad2158b47d050a4a22094/plex_api_client-0.20.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-21 00:04:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LukeHagar",
    "github_project": "plexpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "plex-api-client"
}
        
Elapsed time: 0.50320s