runcloud-sdk 0.7.1__tar.gz → 0.7.2__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.
- {runcloud_sdk-0.7.1/runcloud_sdk.egg-info → runcloud_sdk-0.7.2}/PKG-INFO +1 -1
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/pyproject.toml +1 -1
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/client.py +2 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2/runcloud_sdk.egg-info}/PKG-INFO +1 -1
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/tests/test_sdk.py +21 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/LICENSE +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/README.md +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/__init__.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/__init__.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/blaxel.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/daytona.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/e2b.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/modal.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/sprites.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud/compat/vercel.py +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud_sdk.egg-info/SOURCES.txt +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud_sdk.egg-info/dependency_links.txt +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/runcloud_sdk.egg-info/top_level.txt +0 -0
- {runcloud_sdk-0.7.1 → runcloud_sdk-0.7.2}/setup.cfg +0 -0
|
@@ -15,6 +15,7 @@ from typing import Any, Callable, Optional, Union
|
|
|
15
15
|
|
|
16
16
|
Transport = Callable[[str, str, Any], Any]
|
|
17
17
|
DEFAULT_API_URL = "https://api.run.cloud"
|
|
18
|
+
USER_AGENT = "runcloud-python/0.7.2"
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
class RunCloudError(Exception):
|
|
@@ -131,6 +132,7 @@ class Client:
|
|
|
131
132
|
headers={
|
|
132
133
|
"Authorization": "Bearer " + self.api_key,
|
|
133
134
|
"Content-Type": "application/json",
|
|
135
|
+
"User-Agent": USER_AGENT,
|
|
134
136
|
},
|
|
135
137
|
)
|
|
136
138
|
try:
|
|
@@ -34,6 +34,17 @@ class Recorder:
|
|
|
34
34
|
return SANDBOX
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
class Response:
|
|
38
|
+
def __enter__(self):
|
|
39
|
+
return self
|
|
40
|
+
|
|
41
|
+
def __exit__(self, *_):
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
def read(self):
|
|
45
|
+
return b"{}"
|
|
46
|
+
|
|
47
|
+
|
|
37
48
|
class SDKTests(unittest.TestCase):
|
|
38
49
|
def setUp(self):
|
|
39
50
|
self.recorder = Recorder()
|
|
@@ -80,6 +91,16 @@ class SDKTests(unittest.TestCase):
|
|
|
80
91
|
with self.assertRaises(UnsupportedCompatibilityFeatureError):
|
|
81
92
|
modal.Image.debian_slim().pip_install("requests")
|
|
82
93
|
|
|
94
|
+
def test_requests_identify_the_python_sdk(self):
|
|
95
|
+
with patch(
|
|
96
|
+
"runcloud.client.urllib.request.urlopen",
|
|
97
|
+
return_value=Response(),
|
|
98
|
+
) as urlopen:
|
|
99
|
+
Client(api_key="rc_live_test").request("GET", "/run-cloud/account")
|
|
100
|
+
|
|
101
|
+
request = urlopen.call_args.args[0]
|
|
102
|
+
self.assertEqual(request.get_header("User-agent"), "runcloud-python/0.7.2")
|
|
103
|
+
|
|
83
104
|
|
|
84
105
|
class CredentialTests(unittest.TestCase):
|
|
85
106
|
def setUp(self):
|
|
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
|
|
File without changes
|