Skip to main content

A Python Client for Metablock API

PyPI version Python versions Build codecov

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

metablock-2.0.0.tar.gz (109.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metablock-2.0.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

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

Hashes for metablock-2.0.0.tar.gz
Algorithm Hash digest
SHA256 bde1577f54c72a6be8880e1853e881b612758327a6fb8f68b450ce373116d626
MD5 b02021f2f7addef824b5918d54046c69
BLAKE2b-256 6de317d97f523b7edf5e473a50eb03760f0df177085e43ef7cbee029f4876ee1

See more details on using hashes here.

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

Hashes for metablock-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0ae74b9a217da3ec7edee9309eae104e93c47dfc2f99ffe7e95f316a9180ae8
MD5 7e45e1305edca0ca89ccd516d3233fc9
BLAKE2b-256 87667ff2a5c8bcb1a73ba55f405869e00bdd729d9367d5ceeb662fc5ad17ca79

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.1

2 files

This release

2.0.0 This release

2 files

1.2.0

2 files

1.1.0

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.4

4 files

0.1.3

4 files

0.1.2

2 files

0.1.1

3 files

0.1.0

4 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page