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
- Download this project and use it (copy it in your project, etc).
- 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)
Code-hygiene, Tests and Code Coverage
To ensure that coding styles are followed, run the following command:
pylint --rcfile=.pylintrc freshsalessdk test
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
Which produces output like this:
---------- coverage: platform darwin, python 3.7.4-final-0 -----------
Name Stmts Miss Cover
----------------------------------------------------
freshsalessdk/__init__.py 3 0 100%
freshsalessdk/freshsalessdk.py 130 6 95%
----------------------------------------------------
TOTAL 133 6 95%
We want to maintain more than 90% code coverage. To get lots of debugging data during tests, edit the pytest.ini file.
To get code coverage report in HTML, run this command:
python -m pytest --cov=freshsalessdk --cov-report html:cov_html
License
This project is licensed under the MIT License - see the LICENSE file for details
Metadata
Release files for freshsalessdk 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| freshsalessdk-0.1.3.tar.gz | 6.0 kB | Without provenance | Details for freshsalessdk-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| freshsalessdk-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for freshsalessdk-0.1.3-py3-none-any.whl |
Total release size: 14.6 kB
Release files / freshsalessdk-0.1.3.tar.gz
| Download URL | freshsalessdk-0.1.3.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
558a16b2e6583c3b6af56594418a58d7e20f4ba4dbe5321c278e18607f5626ff
|
|
BLAKE2b-256 checksum How to use checksums |
24767089d7d181707c48f935d8c81ab170666164d58fcb158cb8f979c5bea567
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|
Release files / freshsalessdk-0.1.3-py3-none-any.whl
| Download URL | freshsalessdk-0.1.3-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
652f9469bcfeeb3d5c26f6c1c825a33e34d96975134e4ee2cd1727ddf55142c2
|
|
BLAKE2b-256 checksum How to use checksums |
d789e93804e4b7c31894d366dab8338db04d387e3adaab843eae12c28bb3c761
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6
|
Security for freshsalessdk 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.