Skip to main content

Asynchronous wrapper for Zoho's numerous APIs

Project description

A python wrapper library for Zoho API calls which aims to unify the API for the different Zoho Products (CRM, Support, Projects etc).

The library is written using asynchronous interface i.e.

from talkzoho import crm


async def main():
    account = await crm.get_account(id='7030050000019540342', auth_token='xxx')

However, Talk Zoho also provides the helper function talkzoho.utils.wait for usage in synchronous code.

from talkzoho import crm
from talkzoho.utils import wait


account = wait(crm.get_account, id='7030050000019540342', auth_token='xxx')

Installation

pip install talkzoho

Example Usage

from talkzoho import crm


async def main():
    # Get Account
    account = await crm.get_account(id='7030050000019540342', auth_token='xxx')

    # Insert Lead
    bill = {
        'First Name': 'Bill',
        'Last Name': 'Billson'}
    lead_id = await crm.insert_lead(bill, auth_token='xxx')

    # Filter Leads
    bills = await crm.filter_leads(term='Bill', limit=1, auth_token='xxx')

    # Update Contact
    jill = {
        'CONTACTID': '7030050000019540536',
        'First Name': 'Jill',
        'Last Name': 'Jillson'}
    contact_id = await crm.update_contact(jill, auth_token='xxx')

    # Delete Contact
    success = await crm.delete_contact(id='7030050000019540536', auth_token='xxx')

Error Handling

Zoho use a number of ways to inform the client of errors. For example, CRM always returns a 200 status code with a error message and code in the body, where as books will return more standard looking HTTP errors. Talk Zoho tries to unify these and raises a `tornado.web.HTTPError <http://www.tornadoweb.org/en/stable/web.html#tornado.web.HTTPError>`__. Talk Zoho will also map the Zoho specific codes to their HTTP status code equivalent.

NOTE: Deleting a CRM record (with a correct-looking id) will never return an error.This is the behavior of Zoho’s CRM API.

from talkzoho import crm
from tornado.web import HTTPError


async def main():
    try:
        account = await crm.get_account(id='1234', auth_token='xxx')
    except HTTPError as http_error:
        # HTTPError(404, reason='No record available with the specified record ID.')
        print(http_error)

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

talkzoho-1.0.0.tar.gz (12.8 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: talkzoho-1.0.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for talkzoho-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d5f6b984bcb6f6f32a7d31f22104ce1129627959a1eea425f88f2535364e15e6
MD5 8bb58f1ae85009786a2cbc6ed7a68feb
BLAKE2b-256 09d5f1481aa05305f9fbe8c29f04e2e3ab3f9f8e73f44850354dcbfc7b2adef2

See more details on using hashes here.

Supported by

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