Skip to content


The "SDK" is the zapy python library. It allows to use your request from Python. It is a Python package that allows developers to extend and customize some behavior of the program.

Main file

Using a main file or a python test file is required to use the SDK.


The library has the following modules

base             # contains base classes
requests         # loads, manage and perform requests
api              # exposes an API
store            # global persistance
templating       # evaluate expressions and render
test             # custom test classes
cli              # exposes a cli
utils            # internal utility
    module # for importing ipynb from python and vice versa


Global hooks

Intercept and modify every request with custom code.

from zapy import requests, HttpxArguments

async def global_auth(httpx_args: HttpxArguments):
    httpx_args['auth'] = ('foo', 'bar')
from zapy.requests import hooks, HttpxArguments
from zapy.base import Metadata

async def on_global(httpx_args: HttpxArguments, metadata: Metadata):
    if 'basic_auth' in metadata.tags:
        httpx_args['auth'] = ('foo', 'bar')
    elif 'digest_auth' in metadata.tags:
        httpx_args['auth'] = httpx.DigestAuth("my_user", "password123")


Add Stores variables on bootstrap or at runtime.

from import use_store

# on bootstrap
store = use_store()
store.my_var = 'foo'

Send request

Import or create requests and send them.

from zapy import requests

req = requests.from_file('my_zapy.zapy')
response = await req.send()

Execute chain

Load a chain to execute it and use the variables created.

from zapy.utils import module
rel_path = Path('tests/assets')
# invoke jupyter notebook
chain = await module.load_ipynb(rel_path / 'chain_import.ipynb', variables={
    'rel_path': rel_path
# access a variable