Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 826 Bytes

USAGE.md

File metadata and controls

40 lines (29 loc) · 826 Bytes
# 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)

The same SDK client can also be used to make asychronous requests by importing asyncio.

# 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())