Skip to main content

Is an asynchronous implementation for AlfaCRM API

Project description

AIOAlfacrm

PyPi Package Version Supported python versions MIT License Downloads Tests Codecov

aioalfacrm - is an asynchronous implementation for the AlfaCRM API

Package is in development

Installation using pip

$ pip install aioalfacrm

Example:

import asyncio
from aioalfacrm import AlfaClient
from aioalfacrm.models import Location

HOSTNAME = 'demo.s20.online'
EMAIL = 'api-email@email.example'
API_KEY = 'user-api-token'
BRANCH_ID = 1


async def main():
    alfa_client = AlfaClient(
        hostname=HOSTNAME,
        email=EMAIL,
        api_key=API_KEY,
        branch_id=BRANCH_ID,
    )
    try:
        # Check auth (Optionaly)
        if not await alfa_client.check_auth():
            print('Authentification error')
            return
        # Get branches
        branches = await alfa_client.branch.list(page=0, count=20)

        # Edit branch
        for branch in branches:
            branch.name = f'{branch.name} - Edited'
            # Save branch
            await alfa_client.branch.save(branch)

        # Create location
        location = Location(
            branch_id=1,
            is_active=True,
            name='New location',
        )
        await alfa_client.location.save(location)

    finally:
        # Close session
        await alfa_client.close()


asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())  # For Windows
asyncio.run(main())

Available CRM objects

alfa_client.branch  # Branch
alfa_client.customer  # Customer
alfa_client.location  # Location
alfa_client.study_status  # StudyStatus
alfa_client.subject  # Subject
alfa_client.lead_status  # LeadStatus
alfa_client.lead_source  # LeadSource

Available CRM methods

alfa_client. < object >.list(**filters)  # Get objects list
alfa_client. < object >.get(id)  # Get one object by id
alfa_client. < object >.save(model)  # Create object

Paginator

# Get all objects
for page in alfa_client. < object >.get_paginator():
    objects = page.items

Project details


Download files

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

Source Distribution

aioalfacrm-0.1.1.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

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

aioalfacrm-0.1.1-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file aioalfacrm-0.1.1.tar.gz.

File metadata

  • Download URL: aioalfacrm-0.1.1.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.9 Windows/10

File hashes

Hashes for aioalfacrm-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ecd21e2d51583dd40349c50da8c34ee1d21c829def02316c5b8fda14251bed7c
MD5 7fe5c4af2580be46e9cfdd0175be6ac4
BLAKE2b-256 87a95a34694e3ac0c6f1e2e154ef93617bd7f23e8c0c95256f82eb7ca42aafaf

See more details on using hashes here.

File details

Details for the file aioalfacrm-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aioalfacrm-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.9 Windows/10

File hashes

Hashes for aioalfacrm-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36825da12b360cd5374775f9586aa8b371fe55a28b8bad7a497e19fd95e39c26
MD5 e6b9d69051df4cfd2330a8acd1b5fbad
BLAKE2b-256 1a7d15d484983249f6226ed2da5437f27c73195507a0d75ea05defa63424dc49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page