slotlock 0.3.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.
- slotlock-0.3.0/.gitignore +20 -0
- slotlock-0.3.0/PKG-INFO +48 -0
- slotlock-0.3.0/README.md +36 -0
- slotlock-0.3.0/pyproject.toml +23 -0
- slotlock-0.3.0/release-requirements.txt +25 -0
- slotlock-0.3.0/src/slotlock/__init__.py +17 -0
- slotlock-0.3.0/src/slotlock/_operations.py +829 -0
- slotlock-0.3.0/src/slotlock/_transport.py +238 -0
- slotlock-0.3.0/src/slotlock/py.typed +0 -0
- slotlock-0.3.0/tests/test_client.py +396 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
*.tgz
|
|
4
|
+
.DS_Store
|
|
5
|
+
site/node_modules/
|
|
6
|
+
site/dist/
|
|
7
|
+
site/.astro/
|
|
8
|
+
.wrangler/
|
|
9
|
+
.env
|
|
10
|
+
workers/dashboard/node_modules/
|
|
11
|
+
workers/dashboard/.dev.vars
|
|
12
|
+
workers/dashboard/dist/
|
|
13
|
+
# Language clients' build output
|
|
14
|
+
clients/rust/target/
|
|
15
|
+
clients/java/build/
|
|
16
|
+
clients/java/.gradle/
|
|
17
|
+
clients/dotnet/**/bin/
|
|
18
|
+
clients/dotnet/**/obj/
|
|
19
|
+
__pycache__/
|
|
20
|
+
*.egg-info/
|
slotlock-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: slotlock
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A client for Slotlock's REST API: calendars AI agents cannot double-book.
|
|
5
|
+
Project-URL: Homepage, https://slotlock.pylota.io
|
|
6
|
+
Project-URL: Source, https://github.com/PILOTAAI/slotlock/tree/main/clients/python
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Typing :: Typed
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# Slotlock for Python
|
|
14
|
+
|
|
15
|
+
A client for [Slotlock](https://slotlock.pylota.io)'s REST API: the agent tools and the application
|
|
16
|
+
API, one method per operation. Python 3.10+, standard library only.
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
pip install "git+https://github.com/PILOTAAI/slotlock.git#subdirectory=clients/python"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from slotlock import Client, SlotlockError
|
|
24
|
+
|
|
25
|
+
slotlock = Client("https://calendar.example.com", api_key) # a key with the admin scope
|
|
26
|
+
van = slotlock.create_resource(external_ref="vehicle-42", timezone="Europe/London")["resource"]
|
|
27
|
+
|
|
28
|
+
hold = slotlock.acquire_hold(
|
|
29
|
+
resource_id=van["id"], start="2027-03-29T09:00:00Z", end="2027-03-29T10:00:00Z", ttl_seconds=600
|
|
30
|
+
)["hold"]
|
|
31
|
+
try:
|
|
32
|
+
slotlock.acquire_hold(
|
|
33
|
+
resource_id=van["id"], start="2027-03-29T09:30:00Z", end="2027-03-29T10:30:00Z", ttl_seconds=600
|
|
34
|
+
)
|
|
35
|
+
except SlotlockError as error:
|
|
36
|
+
assert (error.status, error.code) == (409, "overlap")
|
|
37
|
+
|
|
38
|
+
reservation = slotlock.confirm_hold(hold["id"])["reservation"]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- Every method returns the response body as a `dict`; `client.call("slotlock_...", {...})` runs an
|
|
42
|
+
operation by name.
|
|
43
|
+
- A refusal raises `SlotlockError` with `status`, `code` and `retry_after`.
|
|
44
|
+
- `update_event(..., description=None)` clears the description; leaving it out keeps it.
|
|
45
|
+
- `Client(url, key, timeout=30.0, allow_insecure=False, user_agent=None)`. Plain HTTP is refused
|
|
46
|
+
except to `localhost`.
|
|
47
|
+
|
|
48
|
+
The [clients overview](../README.md) covers keys, errors and testing.
|
slotlock-0.3.0/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Slotlock for Python
|
|
2
|
+
|
|
3
|
+
A client for [Slotlock](https://slotlock.pylota.io)'s REST API: the agent tools and the application
|
|
4
|
+
API, one method per operation. Python 3.10+, standard library only.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
pip install "git+https://github.com/PILOTAAI/slotlock.git#subdirectory=clients/python"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
from slotlock import Client, SlotlockError
|
|
12
|
+
|
|
13
|
+
slotlock = Client("https://calendar.example.com", api_key) # a key with the admin scope
|
|
14
|
+
van = slotlock.create_resource(external_ref="vehicle-42", timezone="Europe/London")["resource"]
|
|
15
|
+
|
|
16
|
+
hold = slotlock.acquire_hold(
|
|
17
|
+
resource_id=van["id"], start="2027-03-29T09:00:00Z", end="2027-03-29T10:00:00Z", ttl_seconds=600
|
|
18
|
+
)["hold"]
|
|
19
|
+
try:
|
|
20
|
+
slotlock.acquire_hold(
|
|
21
|
+
resource_id=van["id"], start="2027-03-29T09:30:00Z", end="2027-03-29T10:30:00Z", ttl_seconds=600
|
|
22
|
+
)
|
|
23
|
+
except SlotlockError as error:
|
|
24
|
+
assert (error.status, error.code) == (409, "overlap")
|
|
25
|
+
|
|
26
|
+
reservation = slotlock.confirm_hold(hold["id"])["reservation"]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Every method returns the response body as a `dict`; `client.call("slotlock_...", {...})` runs an
|
|
30
|
+
operation by name.
|
|
31
|
+
- A refusal raises `SlotlockError` with `status`, `code` and `retry_after`.
|
|
32
|
+
- `update_event(..., description=None)` clears the description; leaving it out keeps it.
|
|
33
|
+
- `Client(url, key, timeout=30.0, allow_insecure=False, user_agent=None)`. Plain HTTP is refused
|
|
34
|
+
except to `localhost`.
|
|
35
|
+
|
|
36
|
+
The [clients overview](../README.md) covers keys, errors and testing.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling==1.27.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "slotlock"
|
|
7
|
+
version = "0.3.0"
|
|
8
|
+
description = "A client for Slotlock's REST API: calendars AI agents cannot double-book."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
dependencies = []
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Typing :: Typed",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://slotlock.pylota.io"
|
|
20
|
+
Source = "https://github.com/PILOTAAI/slotlock/tree/main/clients/python"
|
|
21
|
+
|
|
22
|
+
[tool.hatch.build.targets.wheel]
|
|
23
|
+
packages = ["src/slotlock"]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# What release.yml's PyPI job installs to build the sdist and the wheel (python -m build
|
|
2
|
+
# --no-isolation): build and the hatchling backend pyproject.toml names, with every dependency they
|
|
3
|
+
# need on Python 3.12, each at an exact version and its pypi.org sha256 (pip --require-hashes).
|
|
4
|
+
# Versions and hashes from https://pypi.org/pypi/<name>/json on 2026-10-24.
|
|
5
|
+
build==1.6.1 \
|
|
6
|
+
--hash=sha256:ecd351a4be9d35a9eaaba244a7687143c9c7d4aea6ac964e7e7ddab20cbcf4e7 \
|
|
7
|
+
--hash=sha256:51cc11666391ab6f092070437ac747002ff46f3e4113a3622177ee6b488bfc53
|
|
8
|
+
packaging==26.3 \
|
|
9
|
+
--hash=sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c \
|
|
10
|
+
--hash=sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79
|
|
11
|
+
pyproject_hooks==1.3.3 \
|
|
12
|
+
--hash=sha256:5fc53fdac9f7bd63fbcdc868fb5f90b4784d78a53a3d3388cd738b807441a20b \
|
|
13
|
+
--hash=sha256:defda19b854fa0d3bd4f76ea4ddcba8abd7dcfcdd585a6690ade050744fc5f43
|
|
14
|
+
hatchling==1.27.0 \
|
|
15
|
+
--hash=sha256:d3a2f3567c4f926ea39849cdf924c7e99e6686c9c8e288ae1037c8fa2a5d937b \
|
|
16
|
+
--hash=sha256:971c296d9819abb3811112fc52c7a9751c8d381898f36533bb16f9791e941fd6
|
|
17
|
+
pathspec==1.1.1 \
|
|
18
|
+
--hash=sha256:a00ce642f577bf7f473932318056212bc4f8bfdf53128c78bbd5af0b9b20b189 \
|
|
19
|
+
--hash=sha256:17db5ecd524104a120e173814c90367a96a98d07c45b2e10c2f3919fff91bf5a
|
|
20
|
+
pluggy==1.7.0 \
|
|
21
|
+
--hash=sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec \
|
|
22
|
+
--hash=sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8
|
|
23
|
+
trove-classifiers==2026.9.21.13 \
|
|
24
|
+
--hash=sha256:8b1ff4f9c191b1040b71c37f1e445ab99732911e3cd91de52838453a854d7a17 \
|
|
25
|
+
--hash=sha256:0a9ebc8d4e2f3e8a22848c5258033035bec17a3012ac3fea16dbaa764489eb71
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""A client for Slotlock's REST API: the agent tools and the application API, from Python.
|
|
2
|
+
|
|
3
|
+
from slotlock import Client
|
|
4
|
+
|
|
5
|
+
slotlock = Client("https://calendar.example.com", api_key)
|
|
6
|
+
hold = slotlock.acquire_hold(resource_id=..., start=..., end=..., ttl_seconds=600)["hold"]
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from ._operations import OPERATIONS, Operations
|
|
10
|
+
from ._transport import UNSET, SlotlockError, Unset, __version__
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Client(Operations):
|
|
14
|
+
"""A Slotlock server, reached with one API key. `Transport` describes the arguments."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__all__ = ["OPERATIONS", "UNSET", "Client", "SlotlockError", "Unset", "__version__"]
|