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.1.tar.gz (110.5 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.1-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file metablock-2.0.1.tar.gz.

File metadata

  • Download URL: metablock-2.0.1.tar.gz
  • Upload date:
  • Size: 110.5 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.1.tar.gz
Algorithm Hash digest
SHA256 4259d7cfbf8c82f7882616eb538384282b7b53ac0f441540557586afb7eed4d7
MD5 134b9fae29f3bcf396158e64dea761cd
BLAKE2b-256 242d0ae663b90f4a76de235631d25aadee0dfe59c127f05f82f319df49f4425a

See more details on using hashes here.

File details

Details for the file metablock-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: metablock-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 24a2823e58daac6ab1137b08b98864c016847164fb71fe3c612e645e1eda552a
MD5 55ee4ebe4fe1c04c01d777b94a9163d3
BLAKE2b-256 1545aefb0277dc8ab2fc34326a9be47157f3073bc54a91e7020250655b399197

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 files

2.0.0

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