mirror of
https://github.com/LukeHagar/plexpy.git
synced 2025-12-06 04:20:52 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.235.0
This commit is contained in:
@@ -3,10 +3,10 @@ id: 3eeea668-4ef4-464e-a888-bdfa023bedf5
|
||||
management:
|
||||
docChecksum: a91eaf9ec1e6a3a6f4bf0571f5b18bae
|
||||
docVersion: 0.0.3
|
||||
speakeasyVersion: 1.228.1
|
||||
generationVersion: 2.292.0
|
||||
releaseVersion: 0.5.0
|
||||
configChecksum: 88642fda66f8275352708bb77b9deb87
|
||||
speakeasyVersion: 1.235.0
|
||||
generationVersion: 2.298.0
|
||||
releaseVersion: 0.6.0
|
||||
configChecksum: 0711e7b95d1b4f1859b36dda6d47e994
|
||||
repoURL: https://github.com/LukeHagar/plexpy.git
|
||||
repoSubDirectory: .
|
||||
installationURL: https://github.com/LukeHagar/plexpy.git
|
||||
@@ -14,13 +14,13 @@ management:
|
||||
features:
|
||||
python:
|
||||
constsAndDefaults: 0.1.3
|
||||
core: 4.5.2
|
||||
core: 4.6.0
|
||||
flattening: 2.81.1
|
||||
globalSecurity: 2.83.5
|
||||
globalServerURLs: 2.82.2
|
||||
globals: 2.82.1
|
||||
methodServerURLs: 2.82.1
|
||||
nameOverrides: 2.81.1
|
||||
nameOverrides: 2.81.2
|
||||
responseFormat: 0.1.0
|
||||
generatedFiles:
|
||||
- src/plex_api/sdkconfiguration.py
|
||||
|
||||
@@ -12,7 +12,7 @@ generation:
|
||||
auth:
|
||||
oAuth2ClientCredentialsEnabled: false
|
||||
python:
|
||||
version: 0.5.0
|
||||
version: 0.6.0
|
||||
additionalDependencies:
|
||||
dependencies: {}
|
||||
extraDependencies:
|
||||
@@ -33,4 +33,5 @@ python:
|
||||
maxMethodParams: 4
|
||||
outputModelSuffix: output
|
||||
packageName: plex-api-client
|
||||
projectUrls: {}
|
||||
responseFormat: envelope
|
||||
|
||||
@@ -155,7 +155,7 @@ Handling errors in this SDK should largely match your expectations. All operati
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| errors.GetServerCapabilitiesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
### Example
|
||||
|
||||
@@ -277,7 +277,7 @@ import requests
|
||||
|
||||
http_client = requests.Session()
|
||||
http_client.headers.update({'x-custom-header': 'someValue'})
|
||||
s = plex_api.PlexAPI(client: http_client)
|
||||
s = plex_api.PlexAPI(client=http_client)
|
||||
```
|
||||
<!-- End Custom HTTP Client [http-client] -->
|
||||
|
||||
|
||||
10
RELEASES.md
10
RELEASES.md
@@ -119,3 +119,13 @@ Based on:
|
||||
- [python v0.5.0] .
|
||||
### Releases
|
||||
- [PyPI v0.5.0] https://pypi.org/project/plex-api-client/0.5.0 - .
|
||||
|
||||
## 2024-04-03 01:12:00
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.235.0 (2.298.0) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [python v0.6.0] .
|
||||
### Releases
|
||||
- [PyPI v0.6.0] https://pypi.org/project/plex-api-client/0.6.0 - .
|
||||
@@ -49,7 +49,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| errors.GetServerActivitiesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## cancel_server_activities
|
||||
|
||||
@@ -89,4 +89,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
||||
| errors.CancelServerActivitiesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -52,7 +52,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
|
||||
| errors.GetTransientTokenResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_source_connection_information
|
||||
|
||||
@@ -94,4 +94,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
|
||||
| errors.GetSourceConnectionInformationResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -46,7 +46,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.GetButlerTasksResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## start_all_tasks
|
||||
|
||||
@@ -85,7 +85,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.StartAllTasksResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## stop_all_tasks
|
||||
|
||||
@@ -120,7 +120,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.StopAllTasksResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## start_task
|
||||
|
||||
@@ -166,7 +166,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------- | ---------------------------- | ---------------------------- |
|
||||
| errors.StartTaskResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## stop_task
|
||||
|
||||
@@ -208,4 +208,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------- | --------------------------- | --------------------------- |
|
||||
| errors.StopTaskResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -51,7 +51,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.GetGlobalHubsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_library_hubs
|
||||
|
||||
@@ -95,4 +95,4 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.GetLibraryHubsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -59,7 +59,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| errors.GetFileHashResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_recently_added
|
||||
|
||||
@@ -94,7 +94,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| errors.GetRecentlyAddedResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_libraries
|
||||
|
||||
@@ -134,7 +134,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.GetLibrariesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_library
|
||||
|
||||
@@ -215,7 +215,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| errors.GetLibraryResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## delete_library
|
||||
|
||||
@@ -255,7 +255,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.DeleteLibraryResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_library_items
|
||||
|
||||
@@ -316,7 +316,7 @@ if res.object is not None:
|
||||
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------- | --------------- | --------------- |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## refresh_library
|
||||
|
||||
@@ -357,7 +357,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.RefreshLibraryResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## search_library
|
||||
|
||||
@@ -416,7 +416,7 @@ if res.object is not None:
|
||||
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------- | --------------- | --------------- |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_metadata
|
||||
|
||||
@@ -457,7 +457,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| errors.GetMetadataResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_metadata_children
|
||||
|
||||
@@ -498,7 +498,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| errors.GetMetadataChildrenResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_on_deck
|
||||
|
||||
@@ -533,4 +533,4 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------- | ---------------------------- | ---------------------------- |
|
||||
| errors.GetOnDeckResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -54,7 +54,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------- | -------------------------- | -------------------------- |
|
||||
| errors.LogLineResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## log_multi_line
|
||||
|
||||
@@ -118,7 +118,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.LogMultiLineResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## enable_paper_trail
|
||||
|
||||
@@ -153,4 +153,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| errors.EnablePaperTrailResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -50,7 +50,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| errors.MarkPlayedResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## mark_unplayed
|
||||
|
||||
@@ -90,7 +90,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.MarkUnplayedResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## update_play_progress
|
||||
|
||||
@@ -133,4 +133,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
||||
| errors.UpdatePlayProgressResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -69,7 +69,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.CreatePlaylistResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_playlists
|
||||
|
||||
@@ -111,7 +111,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.GetPlaylistsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_playlist
|
||||
|
||||
@@ -153,7 +153,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| errors.GetPlaylistResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## delete_playlist
|
||||
|
||||
@@ -194,7 +194,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.DeletePlaylistResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## update_playlist
|
||||
|
||||
@@ -237,7 +237,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.UpdatePlaylistResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_playlist_contents
|
||||
|
||||
@@ -282,7 +282,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| errors.GetPlaylistContentsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## clear_playlist_contents
|
||||
|
||||
@@ -323,7 +323,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| errors.ClearPlaylistContentsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## add_playlist_contents
|
||||
|
||||
@@ -367,7 +367,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| errors.AddPlaylistContentsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## upload_playlist
|
||||
|
||||
@@ -410,4 +410,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------- | --------------------------------- | --------------------------------- |
|
||||
| errors.UploadPlaylistResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -50,7 +50,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------- | ------------------------- | ------------------------- |
|
||||
| errors.GetPinResponseBody | 400 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_token
|
||||
|
||||
@@ -91,4 +91,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------- | --------------------------- | --------------------------- |
|
||||
| errors.GetTokenResponseBody | 400 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -64,7 +64,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.PerformSearchResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## perform_voice_search
|
||||
|
||||
@@ -110,7 +110,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------- | ------------------------------------- | ------------------------------------- |
|
||||
| errors.PerformVoiceSearchResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_search_results
|
||||
|
||||
@@ -150,4 +150,4 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| errors.GetSearchResultsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -49,7 +49,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
||||
| errors.GetServerCapabilitiesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_server_preferences
|
||||
|
||||
@@ -83,7 +83,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
||||
| errors.GetServerPreferencesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_available_clients
|
||||
|
||||
@@ -117,7 +117,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------------- | -------------------------------------- | -------------------------------------- |
|
||||
| errors.GetAvailableClientsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_devices
|
||||
|
||||
@@ -151,7 +151,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------- | ----------------------------- | ----------------------------- |
|
||||
| errors.GetDevicesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_server_identity
|
||||
|
||||
@@ -185,7 +185,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
|
||||
| errors.GetServerIdentityResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_my_plex_account
|
||||
|
||||
@@ -219,7 +219,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ----------------------------------- | ----------------------------------- | ----------------------------------- |
|
||||
| errors.GetMyPlexAccountResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_resized_photo
|
||||
|
||||
@@ -270,7 +270,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.GetResizedPhotoResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_server_list
|
||||
|
||||
@@ -304,4 +304,4 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.GetServerListResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -45,7 +45,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| errors.GetSessionsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_session_history
|
||||
|
||||
@@ -79,7 +79,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------ | ------------------------------------ | ------------------------------------ |
|
||||
| errors.GetSessionHistoryResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## get_transcode_sessions
|
||||
|
||||
@@ -113,7 +113,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
||||
| errors.GetTranscodeSessionsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## stop_transcode_session
|
||||
|
||||
@@ -153,4 +153,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| --------------------------------------- | --------------------------------------- | --------------------------------------- |
|
||||
| errors.StopTranscodeSessionResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -48,4 +48,4 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| -------------------------------- | -------------------------------- | -------------------------------- |
|
||||
| errors.GetStatisticsResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -45,7 +45,7 @@ if res.object is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.GetUpdateStatusResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## check_for_updates
|
||||
|
||||
@@ -86,7 +86,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ---------------------------------- | ---------------------------------- | ---------------------------------- |
|
||||
| errors.CheckForUpdatesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## apply_updates
|
||||
|
||||
@@ -129,4 +129,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------- | ------------------------------- | ------------------------------- |
|
||||
| errors.ApplyUpdatesResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
@@ -62,7 +62,7 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------ | ------------------------------ | ------------------------------ |
|
||||
| errors.GetTimelineResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
## start_universal_transcode
|
||||
|
||||
@@ -110,4 +110,4 @@ if res is not None:
|
||||
| Error Object | Status Code | Content Type |
|
||||
| ------------------------------------------ | ------------------------------------------ | ------------------------------------------ |
|
||||
| errors.StartUniversalTranscodeResponseBody | 401 | application/json |
|
||||
| errors.SDKError | 4x-5xx | */* |
|
||||
| errors.SDKError | 4xx-5xx | */* |
|
||||
|
||||
3
pylintrc
3
pylintrc
@@ -445,7 +445,8 @@ disable=raw-checker-failed,
|
||||
too-many-nested-blocks,
|
||||
too-many-boolean-expressions,
|
||||
no-else-raise,
|
||||
bare-except
|
||||
bare-except,
|
||||
broad-exception-caught
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
|
||||
3
setup.py
3
setup.py
@@ -10,9 +10,10 @@ except FileNotFoundError:
|
||||
|
||||
setuptools.setup(
|
||||
name="plex-api-client",
|
||||
version="0.5.0",
|
||||
version="0.6.0",
|
||||
author="LukeHagar",
|
||||
description="Python Client SDK Generated by Speakeasy",
|
||||
url="https://github.com/LukeHagar/plexpy.git",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
packages=setuptools.find_packages(where="src"),
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests
|
||||
from .types import SDKInitHook, BeforeRequestContext, BeforeRequestHook, AfterSuccessContext, AfterSuccessHook, AfterErrorContext, AfterErrorHook, Hooks
|
||||
from .registration import init_hooks
|
||||
from typing import List, Optional, Tuple, Union
|
||||
from typing import List, Optional, Tuple
|
||||
|
||||
|
||||
class SDKHooks(Hooks):
|
||||
@@ -31,19 +31,21 @@ class SDKHooks(Hooks):
|
||||
base_url, client = hook.sdk_init(base_url, client)
|
||||
return base_url, client
|
||||
|
||||
def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> Union[requests.PreparedRequest, Exception]:
|
||||
def before_request(self, hook_ctx: BeforeRequestContext, request: requests.PreparedRequest) -> requests.PreparedRequest:
|
||||
for hook in self.before_request_hooks:
|
||||
request = hook.before_request(hook_ctx, request)
|
||||
if isinstance(request, Exception):
|
||||
raise request
|
||||
out = hook.before_request(hook_ctx, request)
|
||||
if isinstance(out, Exception):
|
||||
raise out
|
||||
request = out
|
||||
|
||||
return request
|
||||
|
||||
def after_success(self, hook_ctx: AfterSuccessContext, response: requests.Response) -> requests.Response:
|
||||
for hook in self.after_success_hooks:
|
||||
response = hook.after_success(hook_ctx, response)
|
||||
if isinstance(response, Exception):
|
||||
raise response
|
||||
out = hook.after_success(hook_ctx, response)
|
||||
if isinstance(out, Exception):
|
||||
raise out
|
||||
response = out
|
||||
return response
|
||||
|
||||
def after_error(self, hook_ctx: AfterErrorContext, response: Optional[requests.Response], error: Optional[Exception]) -> Tuple[Optional[requests.Response], Optional[Exception]]:
|
||||
|
||||
@@ -17,15 +17,19 @@ class HookContext:
|
||||
|
||||
|
||||
class BeforeRequestContext(HookContext):
|
||||
pass
|
||||
def __init__(self, hook_ctx: HookContext):
|
||||
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
||||
|
||||
|
||||
class AfterSuccessContext(HookContext):
|
||||
pass
|
||||
def __init__(self, hook_ctx: HookContext):
|
||||
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
||||
|
||||
|
||||
|
||||
class AfterErrorContext(HookContext):
|
||||
pass
|
||||
def __init__(self, hook_ctx: HookContext):
|
||||
super().__init__(hook_ctx.operation_id, hook_ctx.oauth2_scopes, hook_ctx.security_source)
|
||||
|
||||
|
||||
class SDKInitHook(ABC):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -42,30 +42,29 @@ class Activities:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerActivitiesResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -74,7 +73,7 @@ class Activities:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetServerActivitiesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -111,34 +110,33 @@ class Activities:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.CancelServerActivitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.CancelServerActivitiesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
|
||||
class Authentication:
|
||||
@@ -40,34 +40,33 @@ class Authentication:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetTransientTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetTransientTokenResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -106,34 +105,33 @@ class Authentication:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetSourceConnectionInformationResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetSourceConnectionInformationResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -35,30 +35,29 @@ class Butler:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetButlerTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetButlerTasksResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -67,7 +66,7 @@ class Butler:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetButlerTasksResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -104,34 +103,33 @@ class Butler:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StartAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StartAllTasksResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -164,34 +162,33 @@ class Butler:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StopAllTasksResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StopAllTasksResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -232,34 +229,33 @@ class Butler:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StartTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code in [200, 202]:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StartTaskResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -296,34 +292,33 @@ class Butler:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','404','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StopTaskResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code == 404 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StopTaskResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -41,30 +41,29 @@ class Hubs:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetGlobalHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetGlobalHubsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -73,7 +72,7 @@ class Hubs:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetGlobalHubsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -113,30 +112,29 @@ class Hubs:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetLibraryHubsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryHubsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -145,7 +143,7 @@ class Hubs:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetLibraryHubsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -41,34 +41,33 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetFileHashResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetFileHashResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -101,30 +100,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetRecentlyAddedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetRecentlyAddedResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -133,7 +131,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetRecentlyAddedResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -171,30 +169,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetLibrariesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibrariesResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -203,7 +200,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetLibrariesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -280,30 +277,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -312,7 +308,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetLibraryResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -349,34 +345,33 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.DeleteLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.DeleteLibraryResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -433,30 +428,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetLibraryItemsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetLibraryItemsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -494,34 +488,33 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.RefreshLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.RefreshLibraryResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -577,30 +570,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.SearchLibraryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.SearchLibraryResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -638,30 +630,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetMetadataResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMetadataResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -670,7 +661,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetMetadataResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -707,30 +698,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetMetadataChildrenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMetadataChildrenResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -739,7 +729,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetMetadataChildrenResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -772,30 +762,29 @@ class Library:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetOnDeckResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetOnDeckResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -804,7 +793,7 @@ class Library:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetOnDeckResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
|
||||
class Log:
|
||||
@@ -41,34 +41,33 @@ class Log:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.LogLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.LogLineResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -126,34 +125,33 @@ class Log:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, data=data, files=form, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.LogMultiLineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.LogMultiLineResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -186,34 +184,33 @@ class Log:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','403','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.EnablePaperTrailResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code == 403 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.EnablePaperTrailResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
|
||||
class Media:
|
||||
@@ -39,34 +39,33 @@ class Media:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.MarkPlayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.MarkPlayedResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -104,34 +103,33 @@ class Media:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.MarkUnplayedResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.MarkUnplayedResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -171,34 +169,33 @@ class Media:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.UpdatePlayProgressResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.UpdatePlayProgressResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -42,30 +42,29 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.CreatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.CreatePlaylistResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -74,7 +73,7 @@ class Playlists:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.CreatePlaylistResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -113,30 +112,29 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetPlaylistsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -145,7 +143,7 @@ class Playlists:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -183,30 +181,29 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -215,7 +212,7 @@ class Playlists:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -252,34 +249,33 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.DeletePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.DeletePlaylistResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -319,34 +315,33 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('PUT', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.UpdatePlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.UpdatePlaylistResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -388,30 +383,29 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPlaylistContentsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -420,7 +414,7 @@ class Playlists:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetPlaylistContentsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -457,34 +451,33 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.ClearPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.ClearPlaylistContentsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -525,30 +518,29 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('PUT', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.AddPlaylistContentsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.AddPlaylistContentsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -557,7 +549,7 @@ class Playlists:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.AddPlaylistContentsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -596,34 +588,33 @@ class Playlists:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.UploadPlaylistResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.UploadPlaylistResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -43,37 +43,36 @@ class Plex:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('POST', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('POST', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetPinResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetPinResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
content_type = http_res.headers.get('Content-Type')
|
||||
raise errors.SDKError(f'unknown content-type received: {content_type}', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 400:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetPinResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -114,32 +113,31 @@ class Plex:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetTokenResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetTokenResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -16,6 +16,7 @@ from .server import Server
|
||||
from .sessions import Sessions
|
||||
from .statistics import Statistics
|
||||
from .updater import Updater
|
||||
from .utils.retries import RetryConfig
|
||||
from .video import Video
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import SDKHooks
|
||||
@@ -82,7 +83,7 @@ class PlexAPI:
|
||||
server_url: Optional[str] = None,
|
||||
url_params: Optional[Dict[str, str]] = None,
|
||||
client: Optional[requests_http.Session] = None,
|
||||
retry_config: Optional[utils.RetryConfig] = None
|
||||
retry_config: Optional[RetryConfig] = None
|
||||
) -> None:
|
||||
"""Instantiates the SDK configuring it with the provided parameters.
|
||||
|
||||
@@ -105,7 +106,7 @@ class PlexAPI:
|
||||
:param client: The requests.Session HTTP client to use for all operations
|
||||
:type client: requests_http.Session
|
||||
:param retry_config: The utils.RetryConfig to use globally
|
||||
:type retry_config: utils.RetryConfig
|
||||
:type retry_config: RetryConfig
|
||||
"""
|
||||
if client is None:
|
||||
client = requests_http.Session()
|
||||
|
||||
@@ -8,7 +8,7 @@ from .utils.retries import RetryConfig
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from plex_api.models import components
|
||||
from typing import Any, Callable, Dict, List, Tuple, Union
|
||||
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
|
||||
|
||||
|
||||
SERVERS = [
|
||||
@@ -27,20 +27,20 @@ class ServerProtocol(str, Enum):
|
||||
class SDKConfiguration:
|
||||
client: requests_http.Session
|
||||
security: Union[components.Security,Callable[[], components.Security]] = None
|
||||
server_url: str = ''
|
||||
server_idx: int = 0
|
||||
server_url: Optional[str] = ''
|
||||
server_idx: Optional[int] = 0
|
||||
server_defaults: List[Dict[str, str]] = field(default_factory=List)
|
||||
globals: Dict[str, Dict[str, Dict[str, Any]]] = field(default_factory=Dict)
|
||||
language: str = 'python'
|
||||
openapi_doc_version: str = '0.0.3'
|
||||
sdk_version: str = '0.5.0'
|
||||
gen_version: str = '2.292.0'
|
||||
user_agent: str = 'speakeasy-sdk/python 0.5.0 2.292.0 0.0.3 plex-api-client'
|
||||
retry_config: RetryConfig = None
|
||||
_hooks: SDKHooks = None
|
||||
sdk_version: str = '0.6.0'
|
||||
gen_version: str = '2.298.0'
|
||||
user_agent: str = 'speakeasy-sdk/python 0.6.0 2.298.0 0.0.3 plex-api-client'
|
||||
retry_config: Optional[RetryConfig] = None
|
||||
_hooks: Optional[SDKHooks] = None
|
||||
|
||||
def get_server_details(self) -> Tuple[str, Dict[str, str]]:
|
||||
if self.server_url:
|
||||
if self.server_url is not None and self.server_url != '':
|
||||
return utils.remove_suffix(self.server_url, '/'), {}
|
||||
if self.server_idx is None:
|
||||
self.server_idx = 0
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -53,34 +53,33 @@ class Search:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.PerformSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.PerformSearchResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -123,34 +122,33 @@ class Search:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.PerformVoiceSearchResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.PerformVoiceSearchResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -188,30 +186,29 @@ class Search:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetSearchResultsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSearchResultsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -220,7 +217,7 @@ class Search:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetSearchResultsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -35,30 +35,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetServerCapabilitiesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerCapabilitiesResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -67,7 +66,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetServerCapabilitiesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -100,30 +99,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetServerPreferencesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerPreferencesResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -132,7 +130,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetServerPreferencesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -165,30 +163,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetAvailableClientsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetAvailableClientsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -197,7 +194,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetAvailableClientsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -230,30 +227,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetDevicesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetDevicesResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -262,7 +258,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetDevicesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -295,30 +291,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetServerIdentityResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerIdentityResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -327,7 +322,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetServerIdentityResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -360,30 +355,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetMyPlexAccountResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetMyPlexAccountResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -392,7 +386,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetMyPlexAccountResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -426,34 +420,33 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetResizedPhotoResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetResizedPhotoResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -486,30 +479,29 @@ class Server:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetServerListResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetServerListResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -518,7 +510,7 @@ class Server:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetServerListResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -35,30 +35,29 @@ class Sessions:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSessionsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -67,7 +66,7 @@ class Sessions:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetSessionsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -100,30 +99,29 @@ class Sessions:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetSessionHistoryResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetSessionHistoryResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -132,7 +130,7 @@ class Sessions:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetSessionHistoryResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -165,30 +163,29 @@ class Sessions:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetTranscodeSessionsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetTranscodeSessionsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -197,7 +194,7 @@ class Sessions:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetTranscodeSessionsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -234,34 +231,33 @@ class Sessions:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('DELETE', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('DELETE', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StopTranscodeSessionResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 204:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StopTranscodeSessionResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -40,30 +40,29 @@ class Statistics:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetStatisticsResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetStatisticsResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -72,7 +71,7 @@ class Statistics:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetStatisticsResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
from typing import Optional
|
||||
|
||||
@@ -37,30 +37,29 @@ class Updater:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetUpdateStatusResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, Optional[operations.GetUpdateStatusResponseBody])
|
||||
res.object = out
|
||||
else:
|
||||
@@ -69,7 +68,7 @@ class Updater:
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetUpdateStatusResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -107,34 +106,33 @@ class Updater:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('PUT', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.CheckForUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.CheckForUpdatesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -173,34 +171,33 @@ class Updater:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('PUT', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('PUT', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','500','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.ApplyUpdatesResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code == 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.ApplyUpdatesResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
@@ -75,12 +75,12 @@ def retry(func, retries: Retries):
|
||||
if res.status_code == parsed_code:
|
||||
raise TemporaryError(res)
|
||||
except requests.exceptions.ConnectionError as exception:
|
||||
if retries.config.config.retry_connection_errors:
|
||||
if retries.config.retry_connection_errors:
|
||||
raise
|
||||
|
||||
raise PermanentError(exception) from exception
|
||||
except requests.exceptions.Timeout as exception:
|
||||
if retries.config.config.retry_connection_errors:
|
||||
if retries.config.retry_connection_errors:
|
||||
raise
|
||||
|
||||
raise PermanentError(exception) from exception
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import requests as requests_http
|
||||
from .sdkconfiguration import SDKConfiguration
|
||||
from plex_api import utils
|
||||
from plex_api._hooks import HookContext
|
||||
from plex_api._hooks import AfterErrorContext, AfterSuccessContext, BeforeRequestContext, HookContext
|
||||
from plex_api.models import errors, operations
|
||||
|
||||
class Video:
|
||||
@@ -35,34 +35,33 @@ class Video:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.GetTimelineResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.GetTimelineResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
@@ -96,34 +95,33 @@ class Video:
|
||||
client = self.sdk_configuration.client
|
||||
|
||||
try:
|
||||
req = self.sdk_configuration.get_hooks().before_request(
|
||||
hook_ctx,
|
||||
requests_http.Request('GET', url, params=query_params, headers=headers).prepare(),
|
||||
)
|
||||
req = client.prepare_request(requests_http.Request('GET', url, params=query_params, headers=headers))
|
||||
req = self.sdk_configuration.get_hooks().before_request(BeforeRequestContext(hook_ctx), req)
|
||||
http_res = client.send(req)
|
||||
except Exception as e:
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, None, e)
|
||||
raise e
|
||||
_, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), None, e)
|
||||
if e is not None:
|
||||
raise e
|
||||
|
||||
if utils.match_status_codes(['400','401','4XX','5XX'], http_res.status_code):
|
||||
http_res, e = self.sdk_configuration.get_hooks().after_error(hook_ctx, http_res, None)
|
||||
if e:
|
||||
result, e = self.sdk_configuration.get_hooks().after_error(AfterErrorContext(hook_ctx), http_res, None)
|
||||
if e is not None:
|
||||
raise e
|
||||
if result is not None:
|
||||
http_res = result
|
||||
else:
|
||||
result = self.sdk_configuration.get_hooks().after_success(hook_ctx, http_res)
|
||||
if isinstance(result, Exception):
|
||||
raise result
|
||||
http_res = result
|
||||
http_res = self.sdk_configuration.get_hooks().after_success(AfterSuccessContext(hook_ctx), http_res)
|
||||
|
||||
|
||||
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type'), raw_response=http_res)
|
||||
|
||||
res = operations.StartUniversalTranscodeResponse(status_code=http_res.status_code, content_type=http_res.headers.get('Content-Type') or '', raw_response=http_res)
|
||||
|
||||
if http_res.status_code == 200:
|
||||
pass
|
||||
elif http_res.status_code == 400 or http_res.status_code >= 400 and http_res.status_code < 500 or http_res.status_code >= 500 and http_res.status_code < 600:
|
||||
raise errors.SDKError('API error occurred', http_res.status_code, http_res.text, http_res)
|
||||
elif http_res.status_code == 401:
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type'), 'application/json'):
|
||||
if utils.match_content_type(http_res.headers.get('Content-Type') or '', 'application/json'):
|
||||
out = utils.unmarshal_json(http_res.text, errors.StartUniversalTranscodeResponseBody)
|
||||
out.raw_response = http_res
|
||||
raise out
|
||||
|
||||
Reference in New Issue
Block a user