Python
anyrow: every endpoint, with a sync client and an async one, for Python 3.10 and later.
The anyrow package has two clients over the same methods: SDK for regular code and
AsyncSDK for asyncio. Request bodies and responses are typed dictionaries.
InstallLink to section
pip install anyrowIt needs Python 3.10 or later.
Create a clientLink to section
import osfrom anyrow import SDK, ClientConfiganyrow = SDK(ClientConfig( base_url="https://api.anyrow.ai", bearer_token=os.environ["ANYROW_API_KEY"], auth_header_prefix="ApiKey ", timeout=30.0, # seconds))auth_header_prefix="ApiKey " sends the key as Authorization: ApiKey <key>, the scheme API
keys use. For asyncio, build AsyncSDK from the same config and await each call.
Make a callLink to section
An operation's id is its method, with the last part in snake case (tableTemplate.projectList
is anyrow.tableTemplate.project_list). Path parameters come first, in path order, then the
body as a dictionary; query parameters are keyword arguments:
page = anyrow.row.list("proj_...", "tbl_...", limit=50)row = anyrow.row.create("proj_...", "tbl_...", {"vendor": "Acme", "total": 120})Every method also takes timeout= and headers= for that one call.
ErrorsLink to section
A failed call raises. Every error is an APIError with status, message and the parsed
error body in data; each status has its own class:
from anyrow import APIError, ForbiddenErrortry: table = anyrow.table.get("proj_...", "tbl_...")except ForbiddenError: print("The key lacks tables:read")except APIError as error: print(error.status, error.data["error_key"])The classes are BadRequestError (400), UnauthorizedError (401), ForbiddenError (403),
NotFoundError (404), ConflictError (409), UnprocessableEntityError (422),
RateLimitError (429), InternalServerError (500), BadGatewayError (502),
ServiceUnavailableError (503) and GatewayTimeoutError (504); any other status raises
APIStatusError.
Read every rowLink to section
rows, cursor = [], Nonewhile True: page = anyrow.row.list("proj_...", "tbl_...", limit=100, **({"cursor": cursor} if cursor else {})) rows += page["rows"] cursor = page["nextCursor"] if not cursor: breakExtract a documentLink to section
with open("./invoice.txt") as invoice: batch = anyrow.extract.table.once("proj_...", "tbl_...", {"text": invoice.read()})print(batch["status"], batch["result"])Stream an extractionLink to section
AsyncSDK streams the server-sent events as they arrive:
import asyncioimport osfrom anyrow import AsyncSDK, ClientConfigasync def main(): anyrow = AsyncSDK(ClientConfig( base_url="https://api.anyrow.ai", bearer_token=os.environ["ANYROW_API_KEY"], auth_header_prefix="ApiKey ", )) async for event in anyrow.extract.table.stream("proj_...", "tbl_...", {"text": "Invoice 42 from Acme"}): print(event["event"], event["data"])asyncio.run(main())Verify webhooksLink to section
Deliveries follow Standard Webhooks; verify them with the standardwebhooks package as the
Webhooks guide shows.