Skip to main content

Python SDK for accessing Freshsales

Project description

freshsales-sdk-py

Unofficial Python SDK for accessing Freshsales.

Warning: This is undergoing active development and we will accept contributions once things are a little stable.

Installation

  1. Download this project and use it (copy it in your project, etc).
  2. Install it from pip.
pip install freshsalessdk

Usage

To use this SDK you'll need these Freshsales credentials and your Freshsales domain (https://domain.freshsales.io). See official documentation for steps. We'll assume these are available via environment variables thusly:

export FS_API_KEY=xxx
export FS_DOMAIN=yyy

The following snippet shows you how to initialize and use the SDK.

from freshsalessdk import FreshsalesSDK
import os

fs = FreshsalesSDK(
    domain=os.getenv('FS_DOMAIN'),
    api_key=os.getenv('FS_API_KEY')
)

# get contact views
views = fs.contacts.get_views()

# get contacts in a view
view_id = 123
contacts = fs.contacts.get_all(view_id=view_id)
contacts = list(fs.contacts.get_all_generator(view_id=view_id))

# get specific contact
contact_id = 1232
contact = fs.contacts.get(id=contact_id)

# get contact activities
activities = fs.contacts.get_activities(id=contact_id)

# get account views
views = fs.accounts.get_views()

# get accounts in a view
view_id = 123
accounts = fs.accounts.get_all(view_id=view_id)
accounts = list(fs.accounts.get_all_generator(view_id=view_id))

# get one account
account_id = 1221
account = fs.accounts.get(id=account_id)

# get deal views
views = fs.deals.get_views()

# get deals in a view
view_id = 1212
deals = fs.deals.get_all(view_id=view_id)
deals = list(fs.deals.get_all_generator(view_id=view_id))

# get single deal
deal_id = 12121
deal = fs.deals.get(id=deal_id)

Integration Tests and Code Coverage

To run integration tests, you'll need to set FS_DOMAIN and FS_API_KEY environment variables. In addition, you should have a view with all objects "All Contacts" for contacts and similarly "All Accounts" for accounts and "All Deals" for deals. Then simply run:

python -m pytest

To get code coverage, run the tests thusly.

python -m pytest --cov=freshsalessdk

To get code coverage report in HTML, run this command:

python -m pytest --cov=freshsalessdk --cov-report html:cov_html

We want to maintain more than 90% code coverage.

To get lots of debugging data during tests, edit the pytest.ini file.

License

This project is licensed under the MIT License - see the LICENSE file for details

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

freshsalessdk-0.0.6.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

freshsalessdk-0.0.6-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file freshsalessdk-0.0.6.tar.gz.

File metadata

  • Download URL: freshsalessdk-0.0.6.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for freshsalessdk-0.0.6.tar.gz
Algorithm Hash digest
SHA256 26f3f23d7ecd961a6ef2e44d0eb2898d3c551cf3fabc359a2ee1982c98e38762
MD5 c0059bab070113b200def44f5a7ff876
BLAKE2b-256 cd3c61e52f00b1b87b0020a20ee70a1aeb53f5153170bd55fb4970e1d9f68f5a

See more details on using hashes here.

File details

Details for the file freshsalessdk-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: freshsalessdk-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4

File hashes

Hashes for freshsalessdk-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 a978410627623100b1ee75a735a9a2666722379fdfeb169a4a296cdc8e5d25f3
MD5 beae9b5130d24bbd1498b3c3285cef82
BLAKE2b-256 9f2262445bbc9770f0a2bf6bdd443c0d15742b1ed4b45798df455b49f9790fce

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