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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file metablock-2.0.0.tar.gz.
File metadata
- Download URL: metablock-2.0.0.tar.gz
- Upload date:
- Size: 109.6 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bde1577f54c72a6be8880e1853e881b612758327a6fb8f68b450ce373116d626
|
|
| MD5 |
b02021f2f7addef824b5918d54046c69
|
|
| BLAKE2b-256 |
6de317d97f523b7edf5e473a50eb03760f0df177085e43ef7cbee029f4876ee1
|
File details
Details for the file metablock-2.0.0-py3-none-any.whl.
File metadata
- Download URL: metablock-2.0.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0ae74b9a217da3ec7edee9309eae104e93c47dfc2f99ffe7e95f316a9180ae8
|
|
| MD5 |
7e45e1305edca0ca89ccd516d3233fc9
|
|
| BLAKE2b-256 |
87667ff2a5c8bcb1a73ba55f405869e00bdd729d9367d5ceeb662fc5ad17ca79
|