mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
829 B
829 B
# 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 asynchronous 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())