A Python Client for Metablock API
This is an asynchronous python client for metablock API.
Installation
This is a simple python package you can install via pip:
pip install metablock
Usage
Create the client
from metablock import Metablock
cli = Metablock()
# get the user associated with the API token
user = await cli.user.get()
For the authentication token, you can use the METABLOCK_API_TOKEN environment variable,
alternatively, you can pass it to the client constructor:
cli = Metablock(auth_key="your-token")
Most endpoints act within an organization, which is selected by the
x-metablock-org-id header rather than by the URL. Set it via the
METABLOCK_ORG_ID environment variable or pass it to the constructor:
cli = Metablock(auth_key="your-token", org_id="your-org-id")
Resource managers
The client exposes a manager per resource. Managers hold the behaviour and
return plain data models, which are generated from the API's OpenAPI spec and
live in metablock.schema:
# spaces, blocks and extensions are scoped to the org set on the client
spaces = await cli.spaces.get_list()
space = await cli.spaces.get("my-space")
blocks = await cli.spaces.blocks(space.id)
block = await cli.blocks.get(block_id)
await cli.blocks.ship(block.id, "path/to/bundle.zip", env="prod")
extensions = await cli.org_extensions.get_list()
org = await cli.orgs.get("my-org")
Command line
You can also use the client from the command line, to do so, install the package with the cli extra:
pip install metablock[cli]
Then you can use the metablock command:
metablock --help
Metadata
Release files for metablock 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| metablock-2.0.1.tar.gz | 110.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| metablock-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.5 kB
Release files / metablock-2.0.1.tar.gz
| Download URL | metablock-2.0.1.tar.gz |
|---|---|
| Size | 110.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4259d7cfbf8c82f7882616eb538384282b7b53ac0f441540557586afb7eed4d7
|
|
BLAKE2b-256 checksum How to use checksums |
242d0ae663b90f4a76de235631d25aadee0dfe59c127f05f82f319df49f4425a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / metablock-2.0.1-py3-none-any.whl
| Download URL | metablock-2.0.1-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24a2823e58daac6ab1137b08b98864c016847164fb71fe3c612e645e1eda552a
|
|
BLAKE2b-256 checksum How to use checksums |
1545aefb0277dc8ab2fc34326a9be47157f3073bc54a91e7020250655b399197
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|