plotwork 0.1.0__tar.gz → 0.2.0__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.
- {plotwork-0.1.0 → plotwork-0.2.0}/PKG-INFO +2 -3
- {plotwork-0.1.0 → plotwork-0.2.0}/README.md +1 -2
- {plotwork-0.1.0 → plotwork-0.2.0}/pyproject.toml +1 -1
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/__init__.py +0 -5
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/_version.py +1 -1
- {plotwork-0.1.0 → plotwork-0.2.0}/tests/test_request.py +3 -3
- {plotwork-0.1.0 → plotwork-0.2.0}/.gitignore +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/LICENSE +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/README.md +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/_generated.py +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/_request.py +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/src/plotwork/py.typed +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/tests/__init__.py +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/tests/conftest.py +0 -0
- {plotwork-0.1.0 → plotwork-0.2.0}/tests/test_generated.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: plotwork
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: The Plotwork API from Python: validate, draw, render, import and publish diagrams, on the standard library alone.
|
|
5
5
|
Project-URL: Homepage, https://plotwork.dev
|
|
6
6
|
Project-URL: Documentation, https://docs.plotwork.dev/sdks
|
|
@@ -54,7 +54,7 @@ The hosted Plotwork API from Python. Every `/v1` operation (validate, draw, rend
|
|
|
54
54
|
|---|---|
|
|
55
55
|
| What does it install? | Nothing else. |
|
|
56
56
|
| Where do the types come from? | The API's OpenAPI document, kept in the SDK repository as [`spec/openapi.json`](https://github.com/plotwork-official/plotwork-sdk/blob/main/spec/openapi.json). Every request and answer is a `TypedDict`. |
|
|
57
|
-
| How do I sign in? | An API key from the Plotwork portal (`api_key`),
|
|
57
|
+
| How do I sign in? | An API key from the Plotwork portal (`api_key`), sent as `X-API-Key`. |
|
|
58
58
|
| Does a mistake in a diagram raise? | No. It is part of the answer, with a line, a column and a hint. Only a failed request raises, as `PlotworkApiError` with a stable `error_code`. |
|
|
59
59
|
| Does it retry? | A safe call is retried twice on 429 and 503, after the API's `Retry-After`. Publishing is never retried. |
|
|
60
60
|
| Is there a TypeScript client? | Yes, [`@plotwork.official/sdk`](https://www.npmjs.com/package/@plotwork.official/sdk), with the same calls in camelCase. |
|
|
@@ -121,7 +121,6 @@ except PlotworkApiError as error:
|
|
|
121
121
|
| Option | Default |
|
|
122
122
|
|---|---|
|
|
123
123
|
| `api_key` | none |
|
|
124
|
-
| `access_token` | none |
|
|
125
124
|
| `base_url` | `https://api.plotwork.dev` (`https://api-preview.plotwork.dev` for preview, or a self-hosted engine) |
|
|
126
125
|
| `timeout` | `60` seconds |
|
|
127
126
|
| `max_retries` | `2` |
|
|
@@ -25,7 +25,7 @@ The hosted Plotwork API from Python. Every `/v1` operation (validate, draw, rend
|
|
|
25
25
|
|---|---|
|
|
26
26
|
| What does it install? | Nothing else. |
|
|
27
27
|
| Where do the types come from? | The API's OpenAPI document, kept in the SDK repository as [`spec/openapi.json`](https://github.com/plotwork-official/plotwork-sdk/blob/main/spec/openapi.json). Every request and answer is a `TypedDict`. |
|
|
28
|
-
| How do I sign in? | An API key from the Plotwork portal (`api_key`),
|
|
28
|
+
| How do I sign in? | An API key from the Plotwork portal (`api_key`), sent as `X-API-Key`. |
|
|
29
29
|
| Does a mistake in a diagram raise? | No. It is part of the answer, with a line, a column and a hint. Only a failed request raises, as `PlotworkApiError` with a stable `error_code`. |
|
|
30
30
|
| Does it retry? | A safe call is retried twice on 429 and 503, after the API's `Retry-After`. Publishing is never retried. |
|
|
31
31
|
| Is there a TypeScript client? | Yes, [`@plotwork.official/sdk`](https://www.npmjs.com/package/@plotwork.official/sdk), with the same calls in camelCase. |
|
|
@@ -92,7 +92,6 @@ except PlotworkApiError as error:
|
|
|
92
92
|
| Option | Default |
|
|
93
93
|
|---|---|
|
|
94
94
|
| `api_key` | none |
|
|
95
|
-
| `access_token` | none |
|
|
96
95
|
| `base_url` | `https://api.plotwork.dev` (`https://api-preview.plotwork.dev` for preview, or a self-hosted engine) |
|
|
97
96
|
| `timeout` | `60` seconds |
|
|
98
97
|
| `max_retries` | `2` |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "plotwork"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "The Plotwork API from Python: validate, draw, render, import and publish diagrams, on the standard library alone."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -30,7 +30,6 @@ class Plotwork(Operations):
|
|
|
30
30
|
"""The Plotwork API client.
|
|
31
31
|
|
|
32
32
|
:param api_key: An account or organisation API key, sent as ``X-API-Key``. Keep it in an environment variable or a secret store.
|
|
33
|
-
:param access_token: An OAuth access token, sent as ``Authorization: Bearer``, in place of a key.
|
|
34
33
|
:param base_url: The API's address: production by default, ``https://api-preview.plotwork.dev`` for preview, or a self-hosted engine.
|
|
35
34
|
:param timeout: Seconds before a call counts as failed: 60 by default.
|
|
36
35
|
:param max_retries: How many times a safe call is tried again on 429 or 503: 2 by default, 0 to never retry.
|
|
@@ -42,7 +41,6 @@ class Plotwork(Operations):
|
|
|
42
41
|
self,
|
|
43
42
|
*,
|
|
44
43
|
api_key: Optional[str] = None,
|
|
45
|
-
access_token: Optional[str] = None,
|
|
46
44
|
base_url: Optional[str] = None,
|
|
47
45
|
timeout: float = 60.0,
|
|
48
46
|
max_retries: int = 2,
|
|
@@ -52,11 +50,8 @@ class Plotwork(Operations):
|
|
|
52
50
|
headers: Dict[str, str] = {}
|
|
53
51
|
if api_key:
|
|
54
52
|
headers["X-API-Key"] = api_key
|
|
55
|
-
if access_token:
|
|
56
|
-
headers["Authorization"] = f"Bearer {access_token}"
|
|
57
53
|
self._options: Dict[str, Any] = {
|
|
58
54
|
"api_key": api_key,
|
|
59
|
-
"access_token": access_token,
|
|
60
55
|
"base_url": base_url,
|
|
61
56
|
"timeout": timeout,
|
|
62
57
|
"max_retries": max_retries,
|
|
@@ -41,12 +41,12 @@ def test_sends_camel_case_keys_as_the_api_names_them(api: FakeApi) -> None:
|
|
|
41
41
|
assert api.seen[0].json() == {"source": SOURCE, "embedSource": True, "idPrefix": "a"}
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
def
|
|
44
|
+
def test_puts_a_get_input_in_the_query_and_sends_no_key_when_there_is_none(api: FakeApi) -> None:
|
|
45
45
|
api.answer(Answer(body={"results": []}))
|
|
46
|
-
client(api, []
|
|
46
|
+
client(api, []).icons.search(q="token exchange", limit=5)
|
|
47
47
|
seen = api.seen[0]
|
|
48
48
|
assert (seen.method, seen.path) == ("GET", "/v1/icons?q=token+exchange&limit=5")
|
|
49
|
-
assert
|
|
49
|
+
assert "authorization" not in seen.headers
|
|
50
50
|
assert "x-api-key" not in seen.headers
|
|
51
51
|
assert "content-type" not in seen.headers
|
|
52
52
|
assert seen.body is None
|
|
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
|