Giter VIP home page Giter VIP logo

pipedrivepy's Introduction

pipedrivepy

Pipedrive API generic client for Python

Code style: black Linter: pylint

Requirements

pipedrivepy tested under Python 3.6+. Synchoronous version requires requests package. Asynchoronous version requires aiohttp package.

Installation

You can install pipedrivepy with:

  • pip install pipedrivepy[sync] for synchoronous version;
  • pip install pipedrivepy[async] for asynchoronous version;

Usage

Pipedrive API Reference

pipedrivepy uses chain technique to build endpoint path.

For example, client.deals(100).followers makes path to /deals/100/followers.

To send request need call one of control methods:

  • get(**query) to GET request;
  • add(**payload) to POST request;
  • update(**payload) to PUT request;
  • delete(**payload) to DELETE request;

You must first check API method signature to build right path and call right method.

Example usage of synchoronous client

"""Add a deal
https://developers.pipedrive.com/docs/api/v1/#!/Deals/post_deals"""

from pipedrive import PipedriveError
from pipedrive.sio import Client

client = Client('your-company-domain', 'your-token')

def add_deal(title):
    try:
        data = client.deals.add(title='Test deal')
    except PipedriveError as error:
        print(error.code)  # Show HTTP code
        raise ValueError(str(error))

    print(data['data']['id'])

Example usage of asynchoronous client

"""Merging two deals
https://developers.pipedrive.com/docs/api/v1/#!/Deals/put_deals_id_merge"""

from pipedrive import PipedriveError
from pipedrive.aio import Client

client = Client('your-company-domain', 'your-token')

async def merge_deals(deal_id, merge_with_id):
    try:
        data = await client.deals(42).merge.update(merge_with_id=24)
    except PipedriveError as error:
        print(error.code)  # Show HTTP code
        raise ValueError(str(error))

    print(data['data']['id'])

License

MIT

pipedrivepy's People

Contributors

dvemnt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.