mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Update cloudinary-1.26.0
This commit is contained in:
parent
ebffd124f6
commit
4b28040d59
17 changed files with 1169 additions and 307 deletions
42
lib/cloudinary/provisioning/account_config.py
Normal file
42
lib/cloudinary/provisioning/account_config.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from cloudinary import BaseConfig, import_django_settings
|
||||
|
||||
ACCOUNT_URI_SCHEME = "account"
|
||||
|
||||
|
||||
class AccountConfig(BaseConfig):
|
||||
def __init__(self):
|
||||
self._uri_scheme = ACCOUNT_URI_SCHEME
|
||||
|
||||
super(AccountConfig, self).__init__()
|
||||
|
||||
def _config_from_parsed_url(self, parsed_url):
|
||||
if not self._is_url_scheme_valid(parsed_url):
|
||||
raise ValueError("Invalid CLOUDINARY_ACCOUNT_URL scheme. URL should begin with 'account://'")
|
||||
|
||||
return {
|
||||
"account_id": parsed_url.hostname,
|
||||
"provisioning_api_key": parsed_url.username,
|
||||
"provisioning_api_secret": parsed_url.password,
|
||||
}
|
||||
|
||||
def _load_config_from_env(self):
|
||||
if os.environ.get("CLOUDINARY_ACCOUNT_URL"):
|
||||
self._load_from_url(os.environ.get("CLOUDINARY_ACCOUNT_URL"))
|
||||
|
||||
|
||||
def account_config(**keywords):
|
||||
global _account_config
|
||||
_account_config.update(**keywords)
|
||||
return _account_config
|
||||
|
||||
|
||||
def reset_config():
|
||||
global _account_config
|
||||
_account_config = AccountConfig()
|
||||
|
||||
|
||||
_account_config = AccountConfig()
|
Loading…
Add table
Add a link
Reference in a new issue