Files
plex-sdk-docs/content/pages/01-reference/python/errors/_snippet.mdx
2024-01-01 15:47:37 -06:00

32 lines
678 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 sdk
s = sdk.SDK(
access_token="<YOUR_API_KEY_HERE>",
)
res = None
try:
res = s.server.get_server_capabilities()
except errors.GetServerCapabilitiesResponseBody as e:
print(e) # handle exception
raise(e)
except errors.SDKError as e:
print(e) # handle exception
raise(e)
if res.object is not None:
# handle response
pass
```
{/* End Python Errors */}