Skip to navigation

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

from mercoa.client import Mercoa
mercoa_client = Mercoa(token="YOUR_API_KEY")
entity = mercoa_client.entity.get(entity_id='YOUR_ENTITY_ID')
print(entity)

Async client

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

import asyncio
from mercoa.client import AsyncMercoa
mercoa_client = AsyncMercoa(token="YOUR_API_KEY")
async def get_entity() -> None:
entity = await mercoa_client.entity.get(entity_id='YOUR_ENTITY_ID')
print(entity)
asyncio.run(get_entity())