Skip to main content

Python wrapper on the Nutshell CRM JSON RPC API

Project description

Nutshell API

This is a work-in-progress attempt at a pythonic API for querying the Nutshell CRM API. It does not yet support modifying data in a Nutshell instance.

Installation

pip install nutshell

Usage

  • Initialize the API instance with your credentials
  • Create an instance of the method(s) you want to call
  • Pass a single method instance, or a collection of methods to the api_calls property of the API class
  • Execute the method calls on API with the call_api() method
    • aiohttp is used to make the API calls asynchronous
  • Unpack the results
import os

from rich import print

import nutshell
from nutshell import methods

find_activities = methods.FindActivityTypes()
ns = nutshell.NutshellAPI(os.getenv("NUTSHELL_USERNAME"), password=os.getenv("NUTSHELL_KEY"))
ns.api_calls = find_activities
activity_types = ns.call_api()
print(activity_types)

Results are returned as a list of namedtuples with fields method and response. and all responses have a result attribute that contains the data returned by the API.

[
    MethodResponse(
        method=FindActivityTypes(
            api_method='findActivityTypes',
            order_by='name',
            order_direction='ASC',
            limit=50,
            page=1,
            params={
                'orderBy': 'name',
                'orderDirection': 'ASC',
                'limit': 50,
                'page': 1
            }
        ),
        response=FindActivityTypesResult(
            result=[
                ActivityType(
                    stub=True,
                    id=1,
                    rev='1',
                    entity_type='Activity_Types',
                    name='Phone Call / Meeting'
                ),
                ActivityType(
                    stub=True,
                    id=3,
                    rev='3',
                    entity_type='Activity_Types',
                    name='Email/Log'
                ),
            ]
        )
    )
]

TODO

  • Gracefully handle errors on method queries
  • Convenience methods for common queries (Users, Leads, etc.)

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

nutshell-0.3.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

nutshell-0.3.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file nutshell-0.3.2.tar.gz.

File metadata

  • Download URL: nutshell-0.3.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for nutshell-0.3.2.tar.gz
Algorithm Hash digest
SHA256 5883ab87dfb8c14d87b3ade78f13813b3a7f43dd1629c1b54293eb385291b4b6
MD5 776d647e533244140b7ea6c30eb54a28
BLAKE2b-256 ee7f2307d57cab3298f81148cc105c71a5a76ae895318ac3143fe5c61abea5cd

See more details on using hashes here.

File details

Details for the file nutshell-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: nutshell-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.12.3 Darwin/23.4.0

File hashes

Hashes for nutshell-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f52c1c7e432dc5ae9bd58d6edf2229913cc73f91f2c34b8e6b9f3e2f17eb3cc9
MD5 aafb10fd8c9dd4066edb6cd798d9eaba
BLAKE2b-256 16c1f24f13bf22745ac150fdc6fcb958af14f84a71dcb0acb71f276668cb1c8f

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