mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 05:01:14 -07:00
Bump cloudinary from 1.30.0 to 1.32.0 (#1996)
* Bump cloudinary from 1.30.0 to 1.32.0 Bumps [cloudinary](https://github.com/cloudinary/pycloudinary) from 1.30.0 to 1.32.0. - [Release notes](https://github.com/cloudinary/pycloudinary/releases) - [Changelog](https://github.com/cloudinary/pycloudinary/blob/master/CHANGELOG.md) - [Commits](https://github.com/cloudinary/pycloudinary/compare/1.30.0...1.32.0) --- updated-dependencies: - dependency-name: cloudinary dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cloudinary==1.32.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
66fa93cfaf
commit
133c8a3363
8 changed files with 94 additions and 10 deletions
|
@ -38,7 +38,7 @@ CL_BLANK = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAA
|
||||||
URI_SCHEME = "cloudinary"
|
URI_SCHEME = "cloudinary"
|
||||||
API_VERSION = "v1_1"
|
API_VERSION = "v1_1"
|
||||||
|
|
||||||
VERSION = "1.30.0"
|
VERSION = "1.32.0"
|
||||||
|
|
||||||
_USER_PLATFORM_DETAILS = "; ".join((platform(), "Python {}".format(python_version())))
|
_USER_PLATFORM_DETAILS = "; ".join((platform(), "Python {}".format(python_version())))
|
||||||
|
|
||||||
|
@ -234,6 +234,7 @@ _http_client = HttpClient()
|
||||||
|
|
||||||
# FIXME: circular import issue
|
# FIXME: circular import issue
|
||||||
from cloudinary.search import Search
|
from cloudinary.search import Search
|
||||||
|
from cloudinary.search_folders import SearchFolders
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
|
|
|
@ -188,9 +188,9 @@ def _prepare_asset_details_params(**options):
|
||||||
|
|
||||||
:internal
|
:internal
|
||||||
"""
|
"""
|
||||||
return only(options, "exif", "faces", "colors", "image_metadata", "cinemagraph_analysis",
|
return only(options, "exif", "faces", "colors", "image_metadata", "media_metadata", "cinemagraph_analysis",
|
||||||
"pages", "phash", "coordinates", "max_results", "quality_analysis", "derived_next_cursor",
|
"pages", "phash", "coordinates", "max_results", "quality_analysis", "derived_next_cursor",
|
||||||
"accessibility_analysis", "versions")
|
"accessibility_analysis", "versions", "related", "related_next_cursor")
|
||||||
|
|
||||||
|
|
||||||
def update(public_id, **options):
|
def update(public_id, **options):
|
||||||
|
@ -223,6 +223,8 @@ def update(public_id, **options):
|
||||||
params["display_name"] = options.get("display_name")
|
params["display_name"] = options.get("display_name")
|
||||||
if "unique_display_name" in options:
|
if "unique_display_name" in options:
|
||||||
params["unique_display_name"] = options.get("unique_display_name")
|
params["unique_display_name"] = options.get("unique_display_name")
|
||||||
|
if "clear_invalid" in options:
|
||||||
|
params["clear_invalid"] = options.get("clear_invalid")
|
||||||
|
|
||||||
return call_api("post", uri, params, **options)
|
return call_api("post", uri, params, **options)
|
||||||
|
|
||||||
|
@ -293,6 +295,50 @@ def delete_derived_by_transformation(public_ids, transformations,
|
||||||
return call_api("delete", uri, params, **options)
|
return call_api("delete", uri, params, **options)
|
||||||
|
|
||||||
|
|
||||||
|
def add_related_assets(public_id, assets_to_relate, resource_type="image", type="upload", **options):
|
||||||
|
"""
|
||||||
|
Relates an asset to other assets by public IDs.
|
||||||
|
|
||||||
|
:param public_id: The public ID of the asset to update.
|
||||||
|
:type public_id: str
|
||||||
|
:param assets_to_relate: The array of up to 10 fully_qualified_public_ids given as resource_type/type/public_id.
|
||||||
|
:type assets_to_relate: list[str]
|
||||||
|
:param type: The upload type. Defaults to "upload".
|
||||||
|
:type type: str
|
||||||
|
:param resource_type: The type of the resource. Defaults to "image".
|
||||||
|
:type resource_type: str
|
||||||
|
:param options: Additional options.
|
||||||
|
:type options: dict, optional
|
||||||
|
:return: The result of the command.
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
uri = ["resources", "related_assets", resource_type, type, public_id]
|
||||||
|
params = {"assets_to_relate": utils.build_array(assets_to_relate)}
|
||||||
|
return call_json_api("post", uri, params, **options)
|
||||||
|
|
||||||
|
|
||||||
|
def delete_related_assets(public_id, assets_to_unrelate, resource_type="image", type="upload", **options):
|
||||||
|
"""
|
||||||
|
Unrelates an asset from other assets by public IDs.
|
||||||
|
|
||||||
|
:param public_id: The public ID of the asset to update.
|
||||||
|
:type public_id: str
|
||||||
|
:param assets_to_unrelate: The array of up to 10 fully_qualified_public_ids given as resource_type/type/public_id.
|
||||||
|
:type assets_to_unrelate: list[str]
|
||||||
|
:param type: The upload type.
|
||||||
|
:type type: str
|
||||||
|
:param resource_type: The type of the resource: defaults to "image".
|
||||||
|
:type resource_type: str
|
||||||
|
:param options: Additional options.
|
||||||
|
:type options: dict, optional
|
||||||
|
:return: The result of the command.
|
||||||
|
:rtype: dict
|
||||||
|
"""
|
||||||
|
uri = ["resources", "related_assets", resource_type, type, public_id]
|
||||||
|
params = {"assets_to_unrelate": utils.build_array(assets_to_unrelate)}
|
||||||
|
return call_json_api("delete", uri, params, **options)
|
||||||
|
|
||||||
|
|
||||||
def tags(**options):
|
def tags(**options):
|
||||||
resource_type = options.pop("resource_type", "image")
|
resource_type = options.pop("resource_type", "image")
|
||||||
uri = ["tags", resource_type]
|
uri = ["tags", resource_type]
|
||||||
|
|
|
@ -68,9 +68,9 @@ def execute_request(http_connector, method, params, headers, auth, api_url, **op
|
||||||
response = http_connector.request(method.upper(), api_url, processed_params, req_headers, **kw)
|
response = http_connector.request(method.upper(), api_url, processed_params, req_headers, **kw)
|
||||||
body = response.data
|
body = response.data
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
raise GeneralError("Unexpected error {0}", e.message)
|
raise GeneralError("Unexpected error %s" % str(e))
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
raise GeneralError("Socket Error: %s" % (str(e)))
|
raise GeneralError("Socket Error: %s" % str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = json.loads(body.decode('utf-8'))
|
result = json.loads(body.decode('utf-8'))
|
||||||
|
|
|
@ -4,7 +4,11 @@ from cloudinary.api_client.call_api import call_json_api
|
||||||
from cloudinary.utils import unique
|
from cloudinary.utils import unique
|
||||||
|
|
||||||
|
|
||||||
class Search:
|
class Search(object):
|
||||||
|
ASSETS = 'resources'
|
||||||
|
|
||||||
|
_endpoint = ASSETS
|
||||||
|
|
||||||
_KEYS_WITH_UNIQUE_VALUES = {
|
_KEYS_WITH_UNIQUE_VALUES = {
|
||||||
'sort_by': lambda x: next(iter(x)),
|
'sort_by': lambda x: next(iter(x)),
|
||||||
'aggregate': None,
|
'aggregate': None,
|
||||||
|
@ -53,7 +57,7 @@ class Search:
|
||||||
def execute(self, **options):
|
def execute(self, **options):
|
||||||
"""Execute the search and return results."""
|
"""Execute the search and return results."""
|
||||||
options["content_type"] = 'application/json'
|
options["content_type"] = 'application/json'
|
||||||
uri = ['resources', 'search']
|
uri = [self._endpoint, 'search']
|
||||||
return call_json_api('post', uri, self.as_dict(), **options)
|
return call_json_api('post', uri, self.as_dict(), **options)
|
||||||
|
|
||||||
def _add(self, name, value):
|
def _add(self, name, value):
|
||||||
|
@ -72,3 +76,7 @@ class Search:
|
||||||
to_return[key] = value
|
to_return[key] = value
|
||||||
|
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
|
def endpoint(self, endpoint):
|
||||||
|
self._endpoint = endpoint
|
||||||
|
return self
|
||||||
|
|
10
lib/cloudinary/search_folders.py
Normal file
10
lib/cloudinary/search_folders.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
from cloudinary import Search
|
||||||
|
|
||||||
|
|
||||||
|
class SearchFolders(Search):
|
||||||
|
FOLDERS = 'folders'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(SearchFolders, self).__init__()
|
||||||
|
|
||||||
|
self.endpoint(self.FOLDERS)
|
|
@ -168,7 +168,8 @@ def update_metadata(metadata, public_ids, **options):
|
||||||
"timestamp": utils.now(),
|
"timestamp": utils.now(),
|
||||||
"metadata": utils.encode_context(metadata),
|
"metadata": utils.encode_context(metadata),
|
||||||
"public_ids": utils.build_array(public_ids),
|
"public_ids": utils.build_array(public_ids),
|
||||||
"type": options.get("type")
|
"type": options.get("type"),
|
||||||
|
"clear_invalid": options.get("clear_invalid")
|
||||||
}
|
}
|
||||||
|
|
||||||
return call_api("metadata", params, **options)
|
return call_api("metadata", params, **options)
|
||||||
|
|
|
@ -78,6 +78,7 @@ __SIMPLE_UPLOAD_PARAMS = [
|
||||||
"backup",
|
"backup",
|
||||||
"faces",
|
"faces",
|
||||||
"image_metadata",
|
"image_metadata",
|
||||||
|
"media_metadata",
|
||||||
"exif",
|
"exif",
|
||||||
"colors",
|
"colors",
|
||||||
"use_filename",
|
"use_filename",
|
||||||
|
@ -1052,7 +1053,8 @@ def build_custom_headers(headers):
|
||||||
|
|
||||||
|
|
||||||
def build_upload_params(**options):
|
def build_upload_params(**options):
|
||||||
params = {param_name: options.get(param_name) for param_name in __SIMPLE_UPLOAD_PARAMS}
|
params = {param_name: options.get(param_name) for param_name in __SIMPLE_UPLOAD_PARAMS if param_name in options}
|
||||||
|
params["upload_preset"] = params.pop("upload_preset", cloudinary.config().upload_preset)
|
||||||
|
|
||||||
serialized_params = {
|
serialized_params = {
|
||||||
"timestamp": now(),
|
"timestamp": now(),
|
||||||
|
@ -1577,3 +1579,19 @@ def unique(collection, key=None):
|
||||||
to_return[key(element)] = element
|
to_return[key(element)] = element
|
||||||
|
|
||||||
return list(to_return.values())
|
return list(to_return.values())
|
||||||
|
|
||||||
|
|
||||||
|
def fq_public_id(public_id, resource_type="image", type="upload"):
|
||||||
|
"""
|
||||||
|
Returns the fully qualified public id of form resource_type/type/public_id.
|
||||||
|
|
||||||
|
:param public_id: The public ID of the asset.
|
||||||
|
:type public_id: str
|
||||||
|
:param resource_type: The type of the asset. Defaults to "image".
|
||||||
|
:type resource_type: str
|
||||||
|
:param type: The upload type. Defaults to "upload".
|
||||||
|
:type type: str
|
||||||
|
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
return "{resource_type}/{type}/{public_id}".format(resource_type=resource_type, type=type, public_id=public_id)
|
||||||
|
|
|
@ -9,7 +9,7 @@ bleach==6.0.0
|
||||||
certifi==2022.12.7
|
certifi==2022.12.7
|
||||||
cheroot==9.0.0
|
cheroot==9.0.0
|
||||||
cherrypy==18.8.0
|
cherrypy==18.8.0
|
||||||
cloudinary==1.30.0
|
cloudinary==1.32.0
|
||||||
distro==1.8.0
|
distro==1.8.0
|
||||||
dnspython==2.3.0
|
dnspython==2.3.0
|
||||||
facebook-sdk==3.1.0
|
facebook-sdk==3.1.0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue