Python

If you’re working with Python, the official mercoa package is the easiest way to interact with the Mercoa API.

Installation

Add this dependency to your project’s build file:

$pip install mercoa
># or
>poetry add mercoa

Usage

1from mercoa.client import Mercoa
2
3mercoa_client = Mercoa(token="YOUR_API_KEY")
4
5entity = mercoa_client.entity.get(entity_id='YOUR_ENTITY_ID')
6
7print(entity)

Async client

This SDK also includes an async client, which supports the await syntax:

1import asyncio
2from mercoa.client import AsyncMercoa
3
4mercoa_client = AsyncMercoa(token="YOUR_API_KEY")
5
6async def get_entity() -> None:
7 entity = await mercoa_client.entity.get(entity_id='YOUR_ENTITY_ID')
8 print(entity)
9
10asyncio.run(get_entity())