Files
plex-sdk-docs/content/pages/01-reference/python/errors/_snippet.mdx

35 lines
748 B
Plaintext

{/* Start Python Errors */}
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.
### Example
```python
import plex_api
from plex_api.models import errors
s = plex_api.PlexAPI(
access_token="<YOUR_API_KEY_HERE>",
x_plex_client_identifier='Postman',
)
res = None
try:
res = s.server.get_server_capabilities()
except errors.GetServerCapabilitiesResponseBody as e:
# handle exception
raise(e)
except errors.SDKError as e:
# handle exception
raise(e)
if res.object is not None:
# handle response
pass
```
{/* End Python Errors */}