Skip to main content

wrapper for amocrm rest api

Install

Install using pip...

pip install amocrm-api-wrapper

Async support

Every method has an async twin with the _async suffix (e.g. get_leads_async). Async variants use httpx.AsyncClient natively and return awaitables:

import asyncio
from amocrm_api import AmoOAuthClient

async def main():
    client = AmoOAuthClient('<access_token>', '<refresh_token>', '<crm_url>', '<client_id>', '<client_secret>', '<redirect_uri>')
    leads = await client.get_leads_async()
    print(leads)
    await client.close_async()

asyncio.run(main())

For the legacy client the async session is initialized lazily on the first async call, no extra setup is required:

import asyncio
from amocrm_api import AmoLegacyClient

async def main():
    client = AmoLegacyClient('<login>', '<token>', '<crm_url>')
    users = await client.get_users_async()
    print(users)

asyncio.run(main())

Pagination

Methods that return collections across pages (iter_*) fetch all pages lazily, so you don't have to manage page/limit manually. Sync variants are generators, async variants are async generators:

# sync
for lead in client.iter_leads(filters={"name": "x"}):
    print(lead["id"])

# async
async for contact in client.iter_contacts_async():
    print(contact["id"])

Available iterators:

Method Async twin Notes
iter_leads iter_leads_async
iter_contacts iter_contacts_async
iter_companies iter_companies_async
iter_tasks iter_tasks_async
iter_catalog_elements(catalog_id, ...) iter_catalog_elements_async
iter_tags_by_entity_type(entity_type, ...) iter_tags_by_entity_type_async

All accept the same filters/order/with-params as the corresponding get_* methods, but the page argument is handled for you.

Usage

from amocrm_api import AmoLegacyClient # for login password auth
from amocrm_api import AmoOAuthClient # for oauth
from datetime import datetime

client = AmoLegacyClient('<login>', '<password>', '<crm_url>')
client = AmoOAuthClient('<access_token>', '<refresh_token>', '<crm_url>', '<client_id>', '<client_secret>', '<redirect_uri>')
dt = datetime.datetime.today().strftime("%a, %d %b %Y %H-%m-%d")
date_time = f"{dt} UTC"

# for Legacy client
headers = {
    "IF-MODIFIED-SINCE": f"{date_time}",
    "Content-Type": "application/json",
}

client.update_session_params(headers)

Documentation

Per-entity API reference is split into docs/. Every method has an async twin with the _async suffix; each file ends with an async usage example:

Entity File
Account docs/account.md
Leads docs/leads.md
Unsorted leads docs/unsorted.md
Pipelines docs/pipelines.md
Contacts docs/contacts.md
Companies docs/companies.md
Customers docs/customers.md
Catalogs docs/catalogs.md
Tasks docs/tasks.md
Notes docs/notes.md
Events docs/events.md
Tags docs/tags.md
Loss reasons docs/loss_reasons.md
Sources docs/sources.md
Chats docs/chats.md
Users docs/users.md
Webhooks docs/webhooks.md
Widgets docs/widgets.md
Custom fields docs/custom_fields.md

See CHANGELOG.md for release history.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

amocrm_api_wrapper-1.0.0.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

amocrm_api_wrapper-1.0.0-py3-none-any.whl (55.4 kB view details)

Uploaded Python 3

File details

Details for the file amocrm_api_wrapper-1.0.0.tar.gz.

File metadata

  • Download URL: amocrm_api_wrapper-1.0.0.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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 amocrm_api_wrapper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 49ef7d5e1e618fdda724337d3195ca3e9b0a3ab6b05b6c0bb2b51326f8a087ce
MD5 d4b577c2d37b1efb2b9a0502f542c413
BLAKE2b-256 7eae286a2f01e191e5ab8f9c2a6dd156a4792124c52d5339e9d67926fad5f0bb

See more details on using hashes here.

File details

Details for the file amocrm_api_wrapper-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: amocrm_api_wrapper-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 55.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","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 amocrm_api_wrapper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b8f2da2e5598050747e59211d17d40f1561b7d769bd94bd9ba015c1f4a39abd
MD5 75153a15de2f6f0f55f1b293d9eb8aac
BLAKE2b-256 a42dfdfdacf9c0adb3d7aed88336c61f2541cc89549e9f3eb4784a2d95d29422

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.0.20

2 files

0.0.19

1 file

0.0.18

1 file

0.0.17

1 file

0.0.16

1 file

0.0.15

1 file

0.0.14

1 file

0.0.13

1 file

0.0.12

1 file

0.0.11

1 file

0.0.10

1 file

0.0.9

1 file

0.0.8

1 file

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.3

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page