stackmachine 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl
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.
- stackmachine/__init__.py +1 -1
- stackmachine/_async_client.py +20 -8
- stackmachine/_client.py +20 -8
- {stackmachine-0.3.1.dist-info → stackmachine-0.3.2.dist-info}/METADATA +17 -21
- {stackmachine-0.3.1.dist-info → stackmachine-0.3.2.dist-info}/RECORD +6 -6
- {stackmachine-0.3.1.dist-info → stackmachine-0.3.2.dist-info}/WHEEL +0 -0
stackmachine/__init__.py
CHANGED
stackmachine/_async_client.py
CHANGED
|
@@ -25,24 +25,36 @@ class AsyncStackMachine:
|
|
|
25
25
|
self,
|
|
26
26
|
api_key: str,
|
|
27
27
|
*,
|
|
28
|
-
api_url: str =
|
|
28
|
+
api_url: Optional[str] = None,
|
|
29
|
+
apiUrl: Optional[str] = None,
|
|
29
30
|
headers: Optional[Headers] = None,
|
|
30
31
|
timeout: float = DEFAULT_TIMEOUT,
|
|
31
|
-
max_network_retries: int =
|
|
32
|
+
max_network_retries: Optional[int] = None,
|
|
33
|
+
maxNetworkRetries: Optional[int] = None,
|
|
32
34
|
http_client: Optional[httpx.AsyncClient] = None,
|
|
33
35
|
http_transport: Optional[httpx.AsyncBaseTransport] = None,
|
|
34
36
|
) -> None:
|
|
37
|
+
resolved_api_url = (
|
|
38
|
+
api_url if api_url is not None else apiUrl or DEFAULT_API_URL
|
|
39
|
+
)
|
|
40
|
+
resolved_max_retries = (
|
|
41
|
+
max_network_retries
|
|
42
|
+
if max_network_retries is not None
|
|
43
|
+
else maxNetworkRetries
|
|
44
|
+
if maxNetworkRetries is not None
|
|
45
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
46
|
+
)
|
|
35
47
|
self.api_key = api_key
|
|
36
|
-
self.api_url =
|
|
37
|
-
self.apiUrl =
|
|
48
|
+
self.api_url = resolved_api_url
|
|
49
|
+
self.apiUrl = resolved_api_url
|
|
38
50
|
self.timeout = timeout
|
|
39
|
-
self.max_network_retries =
|
|
40
|
-
self.maxNetworkRetries =
|
|
51
|
+
self.max_network_retries = resolved_max_retries
|
|
52
|
+
self.maxNetworkRetries = resolved_max_retries
|
|
41
53
|
self._config = ClientConfig(
|
|
42
|
-
api_url=
|
|
54
|
+
api_url=resolved_api_url,
|
|
43
55
|
headers=headers,
|
|
44
56
|
timeout=timeout,
|
|
45
|
-
max_network_retries=
|
|
57
|
+
max_network_retries=resolved_max_retries,
|
|
46
58
|
)
|
|
47
59
|
self._transport = AsyncTransport(
|
|
48
60
|
api_key,
|
stackmachine/_client.py
CHANGED
|
@@ -25,24 +25,36 @@ class StackMachine:
|
|
|
25
25
|
self,
|
|
26
26
|
api_key: str,
|
|
27
27
|
*,
|
|
28
|
-
api_url: str =
|
|
28
|
+
api_url: Optional[str] = None,
|
|
29
|
+
apiUrl: Optional[str] = None,
|
|
29
30
|
headers: Optional[Headers] = None,
|
|
30
31
|
timeout: float = DEFAULT_TIMEOUT,
|
|
31
|
-
max_network_retries: int =
|
|
32
|
+
max_network_retries: Optional[int] = None,
|
|
33
|
+
maxNetworkRetries: Optional[int] = None,
|
|
32
34
|
http_client: Optional[httpx.Client] = None,
|
|
33
35
|
http_transport: Optional[httpx.BaseTransport] = None,
|
|
34
36
|
) -> None:
|
|
37
|
+
resolved_api_url = (
|
|
38
|
+
api_url if api_url is not None else apiUrl or DEFAULT_API_URL
|
|
39
|
+
)
|
|
40
|
+
resolved_max_retries = (
|
|
41
|
+
max_network_retries
|
|
42
|
+
if max_network_retries is not None
|
|
43
|
+
else maxNetworkRetries
|
|
44
|
+
if maxNetworkRetries is not None
|
|
45
|
+
else DEFAULT_MAX_NETWORK_RETRIES
|
|
46
|
+
)
|
|
35
47
|
self.api_key = api_key
|
|
36
|
-
self.api_url =
|
|
37
|
-
self.apiUrl =
|
|
48
|
+
self.api_url = resolved_api_url
|
|
49
|
+
self.apiUrl = resolved_api_url
|
|
38
50
|
self.timeout = timeout
|
|
39
|
-
self.max_network_retries =
|
|
40
|
-
self.maxNetworkRetries =
|
|
51
|
+
self.max_network_retries = resolved_max_retries
|
|
52
|
+
self.maxNetworkRetries = resolved_max_retries
|
|
41
53
|
self._config = ClientConfig(
|
|
42
|
-
api_url=
|
|
54
|
+
api_url=resolved_api_url,
|
|
43
55
|
headers=headers,
|
|
44
56
|
timeout=timeout,
|
|
45
|
-
max_network_retries=
|
|
57
|
+
max_network_retries=resolved_max_retries,
|
|
46
58
|
)
|
|
47
59
|
self._transport = SyncTransport(
|
|
48
60
|
api_key,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stackmachine
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Python SDK for StackMachine.
|
|
5
5
|
Project-URL: Homepage, https://github.com/stackmachine/sdks/tree/main/python
|
|
6
6
|
Project-URL: Repository, https://github.com/stackmachine/sdks
|
|
@@ -61,15 +61,13 @@ stackmachine = StackMachine("sk_stackmachine_...")
|
|
|
61
61
|
async_stackmachine = AsyncStackMachine("sk_stackmachine_...")
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Both clients accept
|
|
64
|
+
Both clients accept configuration options during initialization:
|
|
65
65
|
|
|
66
66
|
```python
|
|
67
|
-
stackmachine = StackMachine
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"maxNetworkRetries": 2,
|
|
72
|
-
}
|
|
67
|
+
stackmachine = StackMachine(
|
|
68
|
+
"sk_stackmachine_...",
|
|
69
|
+
apiUrl="https://api.stackmachine.com/graphql",
|
|
70
|
+
maxNetworkRetries=2,
|
|
73
71
|
)
|
|
74
72
|
```
|
|
75
73
|
|
|
@@ -101,10 +99,8 @@ async for app in apps:
|
|
|
101
99
|
|
|
102
100
|
```python
|
|
103
101
|
deployment = stackmachine.deployments.create(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"name": "my-app",
|
|
107
|
-
}
|
|
102
|
+
upload_url="https://example.com/app.zip",
|
|
103
|
+
app_name="my-app",
|
|
108
104
|
)
|
|
109
105
|
|
|
110
106
|
version = deployment.wait()
|
|
@@ -112,10 +108,8 @@ version = deployment.wait()
|
|
|
112
108
|
|
|
113
109
|
```python
|
|
114
110
|
deployment = stackmachine.apps.autobuild(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"name": "my-app",
|
|
118
|
-
}
|
|
111
|
+
upload_url="https://example.com/app.zip",
|
|
112
|
+
app_name="my-app",
|
|
119
113
|
)
|
|
120
114
|
```
|
|
121
115
|
|
|
@@ -162,13 +156,15 @@ key = stackmachine.apps.ssh.users.authorized_keys.create(
|
|
|
162
156
|
Most methods accept `request_options` for per-request configuration:
|
|
163
157
|
|
|
164
158
|
```python
|
|
159
|
+
from stackmachine import RequestOptions
|
|
160
|
+
|
|
165
161
|
app = stackmachine.apps.retrieve(
|
|
166
162
|
"app_id",
|
|
167
|
-
request_options=
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
request_options=RequestOptions(
|
|
164
|
+
api_key="sk_stackmachine_other",
|
|
165
|
+
timeout=30,
|
|
166
|
+
idempotency_key="deploy-123",
|
|
167
|
+
),
|
|
172
168
|
)
|
|
173
169
|
```
|
|
174
170
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
stackmachine/__init__.py,sha256=
|
|
2
|
-
stackmachine/_async_client.py,sha256=
|
|
3
|
-
stackmachine/_client.py,sha256=
|
|
1
|
+
stackmachine/__init__.py,sha256=bwLDfnAqwPNZXPsuu9A4eeSRWjZP4aVpfFfLvur2Oos,3742
|
|
2
|
+
stackmachine/_async_client.py,sha256=nZ5Rxbw6Yk8-3cv124p3tKcf_xyRiuYNcWnCiviIaDs,6570
|
|
3
|
+
stackmachine/_client.py,sha256=e3pdGdrCqgSJ4iNxmbyQI74rs41HrbaWI18s9sVMTQg,6396
|
|
4
4
|
stackmachine/_config.py,sha256=vZUvZEIKRkCmAqq8dJ5B6r9cWF0rjHQ21AGS4hsaMKc,912
|
|
5
5
|
stackmachine/_errors.py,sha256=yVJ4U1wUK4kPDXs_PxSlg9VdN9cpmUluToqvKR9r5kc,2708
|
|
6
6
|
stackmachine/_models.py,sha256=sJBXZyN7o16iIsvbeVaSyE5XZmRsnV8zRnmgAmxKMa8,6211
|
|
@@ -20,6 +20,6 @@ stackmachine/resources/domains.py,sha256=oBbtp2X6ya5BQvhFtXFz7aKUGZcqTO4Ky-kOo-G
|
|
|
20
20
|
stackmachine/resources/files.py,sha256=j4fFnFuz2-zM8MRvmRxv7jC47Q_NiTQaYCpR0Kb4Gpk,2701
|
|
21
21
|
stackmachine/resources/ssh.py,sha256=tbqVWyAqeNf_eCjftF1b2Q1ED-ocpuRC2rSHyuzdRGM,22359
|
|
22
22
|
stackmachine/resources/versions.py,sha256=VYMUS2KdoEh4POHm5IFF0Sy1xNI8jrwpHhtoKqgUqfk,7426
|
|
23
|
-
stackmachine-0.3.
|
|
24
|
-
stackmachine-0.3.
|
|
25
|
-
stackmachine-0.3.
|
|
23
|
+
stackmachine-0.3.2.dist-info/METADATA,sha256=gtJcf8dtBiJg3I6qb11uzTouVp3OM0gDxiG4sEYe9bs,4315
|
|
24
|
+
stackmachine-0.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
25
|
+
stackmachine-0.3.2.dist-info/RECORD,,
|
|
File without changes
|