Ayon-Python-Api 1.1.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/PKG-INFO +1 -1
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/server_api.py +1 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/utils.py +48 -11
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/version.py +1 -1
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/PKG-INFO +1 -1
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/pyproject.toml +2 -2
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/LICENSE +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/README.md +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/__init__.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/_api.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/constants.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/entity_hub.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/events.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/graphql.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/operations.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_api/typing.py +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/SOURCES.txt +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/setup.cfg +0 -0
- {ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/setup.py +0 -0
|
@@ -1257,6 +1257,7 @@ class ServerAPI(object):
|
|
|
1257
1257
|
"Content-Type": content_type,
|
|
1258
1258
|
"x-ayon-platform": platform.system().lower(),
|
|
1259
1259
|
"x-ayon-hostname": platform.node(),
|
|
1260
|
+
"referer": self.get_base_url(),
|
|
1260
1261
|
}
|
|
1261
1262
|
if self._site_id is not None:
|
|
1262
1263
|
headers["x-ayon-site-id"] = self._site_id
|
|
@@ -4,6 +4,7 @@ import datetime
|
|
|
4
4
|
import uuid
|
|
5
5
|
import string
|
|
6
6
|
import platform
|
|
7
|
+
import traceback
|
|
7
8
|
import collections
|
|
8
9
|
from urllib.parse import urlparse, urlencode
|
|
9
10
|
import typing
|
|
@@ -322,18 +323,38 @@ def _try_parse_url(url: str) -> Optional[str]:
|
|
|
322
323
|
|
|
323
324
|
|
|
324
325
|
def _try_connect_to_server(
|
|
325
|
-
url: str,
|
|
326
|
-
|
|
326
|
+
url: str,
|
|
327
|
+
timeout: Optional[float],
|
|
328
|
+
verify: Optional["Union[str, bool]"],
|
|
329
|
+
cert: Optional[str],
|
|
330
|
+
) -> Optional[str]:
|
|
327
331
|
if timeout is None:
|
|
328
332
|
timeout = get_default_timeout()
|
|
333
|
+
|
|
334
|
+
if verify is None:
|
|
335
|
+
verify = os.environ.get("AYON_CA_FILE") or True
|
|
336
|
+
|
|
337
|
+
if cert is None:
|
|
338
|
+
cert = os.environ.get("AYON_CERT_FILE") or None
|
|
339
|
+
|
|
329
340
|
try:
|
|
330
341
|
# TODO add validation if the url lead to AYON server
|
|
331
342
|
# - this won't validate if the url lead to 'google.com'
|
|
332
|
-
requests.get(
|
|
343
|
+
response = requests.get(
|
|
344
|
+
url,
|
|
345
|
+
timeout=timeout,
|
|
346
|
+
verify=verify,
|
|
347
|
+
cert=cert,
|
|
348
|
+
)
|
|
349
|
+
if response.history:
|
|
350
|
+
return response.history[-1].headers["location"].rstrip("/")
|
|
351
|
+
return url
|
|
333
352
|
|
|
334
|
-
except
|
|
335
|
-
|
|
336
|
-
|
|
353
|
+
except Exception:
|
|
354
|
+
print(f"Failed to connect to '{url}'")
|
|
355
|
+
traceback.print_exc()
|
|
356
|
+
|
|
357
|
+
return None
|
|
337
358
|
|
|
338
359
|
|
|
339
360
|
def login_to_server(
|
|
@@ -463,7 +484,12 @@ def is_token_valid(
|
|
|
463
484
|
return False
|
|
464
485
|
|
|
465
486
|
|
|
466
|
-
def validate_url(
|
|
487
|
+
def validate_url(
|
|
488
|
+
url: str,
|
|
489
|
+
timeout: Optional[int] = None,
|
|
490
|
+
verify: Optional["Union[str, bool]"] = None,
|
|
491
|
+
cert: Optional[str] = None,
|
|
492
|
+
) -> str:
|
|
467
493
|
"""Validate url if is valid and server is available.
|
|
468
494
|
|
|
469
495
|
Validation checks if can be parsed as url and contains scheme.
|
|
@@ -520,12 +546,23 @@ def validate_url(url: str, timeout: Optional[int] = None) -> str:
|
|
|
520
546
|
# Try add 'https://' scheme if is missing
|
|
521
547
|
# - this will trigger UrlError if both will crash
|
|
522
548
|
if not parsed_url.scheme:
|
|
523
|
-
new_url =
|
|
524
|
-
|
|
549
|
+
new_url = _try_connect_to_server(
|
|
550
|
+
"http://" + modified_url,
|
|
551
|
+
timeout=timeout,
|
|
552
|
+
verify=verify,
|
|
553
|
+
cert=cert,
|
|
554
|
+
)
|
|
555
|
+
if new_url:
|
|
525
556
|
return new_url
|
|
526
557
|
|
|
527
|
-
|
|
528
|
-
|
|
558
|
+
new_url = _try_connect_to_server(
|
|
559
|
+
modified_url,
|
|
560
|
+
timeout=timeout,
|
|
561
|
+
verify=verify,
|
|
562
|
+
cert=cert,
|
|
563
|
+
)
|
|
564
|
+
if new_url:
|
|
565
|
+
return new_url
|
|
529
566
|
|
|
530
567
|
hints = []
|
|
531
568
|
if "/" in parsed_url.path or not parsed_url.scheme:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Package declaring Python API for AYON server."""
|
|
2
|
-
__version__ = "1.1.
|
|
2
|
+
__version__ = "1.1.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ayon-python-api"
|
|
3
|
-
version = "1.1.
|
|
3
|
+
version = "1.1.1"
|
|
4
4
|
description = "AYON Python API"
|
|
5
5
|
license = {file = "LICENSE"}
|
|
6
6
|
readme = {file = "README.md", content-type = "text/markdown"}
|
|
@@ -28,7 +28,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
28
28
|
|
|
29
29
|
[tool.poetry]
|
|
30
30
|
name = "ayon-python-api"
|
|
31
|
-
version = "1.1.
|
|
31
|
+
version = "1.1.1"
|
|
32
32
|
description = "AYON Python API"
|
|
33
33
|
authors = [
|
|
34
34
|
"ynput.io <info@ynput.io>"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ayon-python-api-1.1.0 → ayon-python-api-1.1.1}/ayon_python_api.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|