wherobots-python-dbapi 0.7.3__tar.gz → 0.7.5__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.
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/PKG-INFO +1 -1
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/pyproject.toml +1 -1
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/driver.py +17 -2
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/runtime.py +6 -6
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/LICENSE +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/README.md +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/__init__.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/__init__.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/connection.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/constants.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/cursor.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/errors.py +0 -0
- {wherobots_python_dbapi-0.7.3 → wherobots_python_dbapi-0.7.5}/wherobots/db/region.py +0 -0
|
@@ -4,9 +4,12 @@ A PEP-0249 compatible driver for interfacing with Wherobots DB.
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
import logging
|
|
7
|
-
import
|
|
7
|
+
import platform
|
|
8
8
|
import urllib.parse
|
|
9
9
|
import queue
|
|
10
|
+
from importlib import metadata
|
|
11
|
+
from importlib.metadata import PackageNotFoundError
|
|
12
|
+
|
|
10
13
|
import requests
|
|
11
14
|
import tenacity
|
|
12
15
|
import threading
|
|
@@ -39,6 +42,18 @@ threadsafety = 1
|
|
|
39
42
|
paramstyle = "pyformat"
|
|
40
43
|
|
|
41
44
|
|
|
45
|
+
def gen_user_agent_header():
|
|
46
|
+
try:
|
|
47
|
+
package_version = metadata.version("wherobots-python-dbapi")
|
|
48
|
+
except PackageNotFoundError:
|
|
49
|
+
package_version = "unknown"
|
|
50
|
+
python_version = platform.python_version()
|
|
51
|
+
system = platform.system().lower()
|
|
52
|
+
return {
|
|
53
|
+
"User-Agent": f"wherobots-python-dbapi/{package_version} os/{system} python/{python_version}"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
42
57
|
def connect(
|
|
43
58
|
host: str = DEFAULT_ENDPOINT,
|
|
44
59
|
token: str = None,
|
|
@@ -57,7 +72,7 @@ def connect(
|
|
|
57
72
|
if token and api_key:
|
|
58
73
|
raise ValueError("`token` and `api_key` can't be both provided")
|
|
59
74
|
|
|
60
|
-
headers =
|
|
75
|
+
headers = gen_user_agent_header()
|
|
61
76
|
if token:
|
|
62
77
|
headers["Authorization"] = f"Bearer {token}"
|
|
63
78
|
elif api_key:
|
|
@@ -2,12 +2,12 @@ from enum import Enum
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class Runtime(Enum):
|
|
5
|
-
SEDONA = "
|
|
6
|
-
SAN_FRANCISCO = "
|
|
7
|
-
NEW_YORK = "
|
|
8
|
-
CAIRO = "
|
|
9
|
-
DELHI = "
|
|
10
|
-
TOKYO = "
|
|
5
|
+
SEDONA = "tiny"
|
|
6
|
+
SAN_FRANCISCO = "small"
|
|
7
|
+
NEW_YORK = "medium"
|
|
8
|
+
CAIRO = "large"
|
|
9
|
+
DELHI = "x-large"
|
|
10
|
+
TOKYO = "2x-large"
|
|
11
11
|
ATLANTIS = "4x-large"
|
|
12
12
|
|
|
13
13
|
NEW_YORK_HIMEM = "medium-himem"
|
|
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
|