mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
844 B
844 B
# Synchronous Example
from plex_api_client import PlexAPI
s = PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier="gcgzw5rz2xovp84b4vha3a40",
)
res = s.server.get_server_capabilities()
if res.object is not None:
# handle response
pass
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():
s = PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier="gcgzw5rz2xovp84b4vha3a40",
)
res = await s.server.get_server_capabilities_async()
if res.object is not None:
# handle response
pass
asyncio.run(main())