runcloud-sdk 0.7.3__tar.gz → 0.7.4__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.3/runcloud_sdk.egg-info → runcloud_sdk-0.7.4}/PKG-INFO +1 -1
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/pyproject.toml +1 -1
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/client.py +8 -6
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4/runcloud_sdk.egg-info}/PKG-INFO +1 -1
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/tests/test_sdk.py +14 -1
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/LICENSE +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/README.md +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/__init__.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/__init__.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/blaxel.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/daytona.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/e2b.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/modal.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/sprites.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud/compat/vercel.py +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud_sdk.egg-info/SOURCES.txt +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud_sdk.egg-info/dependency_links.txt +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/runcloud_sdk.egg-info/top_level.txt +0 -0
- {runcloud_sdk-0.7.3 → runcloud_sdk-0.7.4}/setup.cfg +0 -0
|
@@ -15,7 +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.
|
|
18
|
+
USER_AGENT = "runcloud-python/0.7.4"
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class RunCloudError(Exception):
|
|
@@ -125,15 +125,17 @@ class Client:
|
|
|
125
125
|
if self._transport is not None:
|
|
126
126
|
return self._transport(method, path, body)
|
|
127
127
|
data = json.dumps(body).encode() if body is not None else None
|
|
128
|
+
headers = {
|
|
129
|
+
"Authorization": "Bearer " + self.api_key,
|
|
130
|
+
"User-Agent": USER_AGENT,
|
|
131
|
+
}
|
|
132
|
+
if body is not None:
|
|
133
|
+
headers["Content-Type"] = "application/json"
|
|
128
134
|
request = urllib.request.Request(
|
|
129
135
|
self.api_url + path,
|
|
130
136
|
data=data,
|
|
131
137
|
method=method,
|
|
132
|
-
headers=
|
|
133
|
-
"Authorization": "Bearer " + self.api_key,
|
|
134
|
-
"Content-Type": "application/json",
|
|
135
|
-
"User-Agent": USER_AGENT,
|
|
136
|
-
},
|
|
138
|
+
headers=headers,
|
|
137
139
|
)
|
|
138
140
|
try:
|
|
139
141
|
with urllib.request.urlopen(request, timeout=self.timeout) as response:
|
|
@@ -104,7 +104,20 @@ class SDKTests(unittest.TestCase):
|
|
|
104
104
|
Client(api_key="rc_live_test").request("GET", "/run-cloud/account")
|
|
105
105
|
|
|
106
106
|
request = urlopen.call_args.args[0]
|
|
107
|
-
self.assertEqual(request.get_header("User-agent"), "runcloud-python/0.7.
|
|
107
|
+
self.assertEqual(request.get_header("User-agent"), "runcloud-python/0.7.4")
|
|
108
|
+
|
|
109
|
+
def test_content_type_is_only_sent_with_a_json_body(self):
|
|
110
|
+
with patch(
|
|
111
|
+
"runcloud.client.urllib.request.urlopen",
|
|
112
|
+
return_value=Response(),
|
|
113
|
+
) as urlopen:
|
|
114
|
+
client = Client(api_key="rc_live_test")
|
|
115
|
+
client.request("DELETE", "/run-cloud/sandboxes/sbx_test")
|
|
116
|
+
client.request("POST", "/run-cloud/sandboxes", {})
|
|
117
|
+
|
|
118
|
+
delete_request, post_request = (call.args[0] for call in urlopen.call_args_list)
|
|
119
|
+
self.assertIsNone(delete_request.get_header("Content-type"))
|
|
120
|
+
self.assertEqual(post_request.get_header("Content-type"), "application/json")
|
|
108
121
|
|
|
109
122
|
|
|
110
123
|
class CredentialTests(unittest.TestCase):
|
|
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
|