From 434c6824701942cfe8d0cbe658c31dafefe76151 Mon Sep 17 00:00:00 2001 From: Julien Bordet Date: Thu, 3 Feb 2022 19:22:31 +0100 Subject: [PATCH 01/15] Get stages back --- pipedrive/client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pipedrive/client.py b/pipedrive/client.py index a56bc47..49f9b3b 100644 --- a/pipedrive/client.py +++ b/pipedrive/client.py @@ -13,6 +13,7 @@ from pipedrive.persons import Persons from pipedrive.pipelines import Pipelines from pipedrive.products import Products +from pipedrive.stages import Stages from pipedrive.recents import Recents from pipedrive.users import Users from pipedrive.webhooks import Webhooks @@ -38,6 +39,7 @@ def __init__(self, client_id=None, client_secret=None, domain=None): self.pipelines = Pipelines(self) self.products = Products(self) self.recents = Recents(self) + self.stages = Stages(self) self.users = Users(self) self.webhooks = Webhooks(self) From 16cfecaebff3f81c31d71dc2d343b2e80ff2c676 Mon Sep 17 00:00:00 2001 From: Julien Bordet Date: Thu, 3 Feb 2022 21:00:51 +0100 Subject: [PATCH 02/15] add Subscriptions interface for Pipedrive --- pipedrive/client.py | 2 ++ pipedrive/subscriptions.py | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 pipedrive/subscriptions.py diff --git a/pipedrive/client.py b/pipedrive/client.py index a56bc47..803bd16 100644 --- a/pipedrive/client.py +++ b/pipedrive/client.py @@ -14,6 +14,7 @@ from pipedrive.pipelines import Pipelines from pipedrive.products import Products from pipedrive.recents import Recents +from pipedrive.subscriptions import Subscriptions from pipedrive.users import Users from pipedrive.webhooks import Webhooks @@ -37,6 +38,7 @@ def __init__(self, client_id=None, client_secret=None, domain=None): self.persons = Persons(self) self.pipelines = Pipelines(self) self.products = Products(self) + self.subscriptions = Subscriptions(self) self.recents = Recents(self) self.users = Users(self) self.webhooks = Webhooks(self) diff --git a/pipedrive/subscriptions.py b/pipedrive/subscriptions.py new file mode 100644 index 0000000..feb8cae --- /dev/null +++ b/pipedrive/subscriptions.py @@ -0,0 +1,39 @@ +class Subscriptions(object): + def __init__(self, client): + self._client = client + + def get_subscription(self, subscription_id, **kwargs): + url = 'subscriptions/{}'.format(subscription_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def get_deal_subscription(self, deal_id, **kwargs): + url = 'subscriptions/find/{}'.format(deal_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def get_all_payments(self, subscription_id, **kwargs): + url = 'subscriptions/{}/payments'.format(subscription_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) + + def add_recurring_subscription(self, data, **kwargs): + url = 'subscriptions/recurring' + return self._client._post(self._client.BASE_URL + url, data, **kwargs) + + def add_installment_subscription(self, data, **kwargs): + url = 'subscriptions/installment' + return self._client._post(self._client.BASE_URL + url, data, **kwargs) + + def update_recurring_subscription(self, subscription_id, data, **kwargs): + url = 'subscriptions/recurring/{}'.format(subscription_id) + return self._client._put(self._client.base_url + url, data, **kwargs) + + def update_installment_subscription(self, subscription_id, data, **kwargs): + url = 'subscriptions/installment/{}'.format(subscription_id) + return self._client._put(self._client.base_url + url, data, **kwargs) + + def cancel_recurring_subscription(self, subscription_id, data, **kwargs): + url = 'subscriptions/recurring/{}/cancel'.format(subscription_id) + return self._client._put(self._client.base_url + url, data, **kwargs) + + def delete_subscription(self, subscription_id, **kwargs): + url = 'subscriptions/{}'.format(subscription_id) + return self._client._delete(self._client.BASE_URL + url, **kwargs) From aef12e421b7d182e1776ad1374bae887a874e208 Mon Sep 17 00:00:00 2001 From: Sadik Bakiu Date: Wed, 23 Mar 2022 12:02:24 +0100 Subject: [PATCH 03/15] Add deal/{id}/flow endpoint --- README.md | 5 +++++ pipedrive/deals.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index faf3aa8..616f759 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,11 @@ response = client.deals.get_deal_products('DEAL_ID') response = client.deals.get_deal_fields() ``` +#### Get updates of a deal +``` +response = client.deals.get_deal_updates('DEAL_ID') +``` + ### Filters API docs: https://developers.pipedrive.com/docs/api/v1/#!/Filters diff --git a/pipedrive/deals.py b/pipedrive/deals.py index 9c86153..118d025 100644 --- a/pipedrive/deals.py +++ b/pipedrive/deals.py @@ -87,3 +87,7 @@ def get_deal_fields(self, params=None, **kwargs): def add_product_to_deal(self, deal_id, data, **kwargs): url = 'deals/{}/products'.format(deal_id) return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) + + def get_deal_updates(self, deal_id, **kwargs): + url = 'deals/{}/flow'.format(deal_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) From 150585f952d6137957352812f2641fff9e4c4850 Mon Sep 17 00:00:00 2001 From: "Teal (P&B)" <87190689+teal-pb@users.noreply.github.com> Date: Fri, 15 Apr 2022 18:58:10 +0200 Subject: [PATCH 04/15] Add support for `organizations/:id/persons` call https://developers.pipedrive.com/docs/api/v1/Organizations#getOrganizationPersons --- pipedrive/organizations.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pipedrive/organizations.py b/pipedrive/organizations.py index dbf6475..1c6743a 100644 --- a/pipedrive/organizations.py +++ b/pipedrive/organizations.py @@ -28,4 +28,8 @@ def get_organization_fields(self, params=None, **kwargs): def search_organizations(self, params=None, **kwargs): url = 'organizations/search' - return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) \ No newline at end of file + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + + def get_organization_persons(self, organization_id, params=None, **kwargs): + url = 'organizations/{}/persons'.format(organization_id) + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) From 62d5730f509dffb70f72f429c7943657961e1190 Mon Sep 17 00:00:00 2001 From: rusty Date: Thu, 8 Sep 2022 10:32:22 +0300 Subject: [PATCH 05/15] Added PATCH client method, fix Lead update method --- pipedrive/client.py | 30 +++++++++++++++++++++++++----- pipedrive/leads.py | 14 +++++++------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/pipedrive/client.py b/pipedrive/client.py index a56bc47..463371e 100644 --- a/pipedrive/client.py +++ b/pipedrive/client.py @@ -58,15 +58,27 @@ def authorization_url(self, redirect_uri, state=None): return self.OAUTH_BASE_URL + "authorize?" + urlencode(params) def exchange_code(self, redirect_uri, code): - data = {"grant_type": "authorization_code", "code": code, "redirect_uri": redirect_uri} - return self._post(self.OAUTH_BASE_URL + "token", data=data, auth=(self.client_id, self.client_secret)) + data = { + "grant_type": "authorization_code", + "code": code, + "redirect_uri": redirect_uri, + } + return self._post( + self.OAUTH_BASE_URL + "token", + data=data, + auth=(self.client_id, self.client_secret), + ) def refresh_token(self, refresh_token): data = { "grant_type": "refresh_token", "refresh_token": refresh_token, } - return self._post(self.OAUTH_BASE_URL + "token", data=data, auth=(self.client_id, self.client_secret)) + return self._post( + self.OAUTH_BASE_URL + "token", + data=data, + auth=(self.client_id, self.client_secret), + ) def set_access_token(self, access_token): self.access_token = access_token @@ -83,6 +95,9 @@ def _post(self, url, **kwargs): def _put(self, url, **kwargs): return self._request("put", url, **kwargs) + def _patch(self, url, **kwargs): + return self._request("patch", url, **kwargs) + def _delete(self, url, **kwargs): return self._request("delete", url, **kwargs) @@ -97,11 +112,16 @@ def _request(self, method, url, headers=None, params=None, **kwargs): _headers.update(headers) if params: _params.update(params) - return self._parse(requests.request(method, url, headers=_headers, params=_params, **kwargs)) + return self._parse( + requests.request(method, url, headers=_headers, params=_params, **kwargs) + ) def _parse(self, response): status_code = response.status_code - if "Content-Type" in response.headers and "application/json" in response.headers["Content-Type"]: + if ( + "Content-Type" in response.headers + and "application/json" in response.headers["Content-Type"] + ): r = response.json() else: return response.text diff --git a/pipedrive/leads.py b/pipedrive/leads.py index b910116..9ea9802 100644 --- a/pipedrive/leads.py +++ b/pipedrive/leads.py @@ -3,25 +3,25 @@ def __init__(self, client): self._client = client def get_lead(self, lead_id, **kwargs): - url = 'leads/{}'.format(lead_id) + url = "leads/{}".format(lead_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_leads(self, **kwargs): - url = 'leads' + url = "leads" return self._client._get(self._client.BASE_URL + url, **kwargs) def create_lead(self, data, **kwargs): - url = 'leads' + url = "leads" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_lead(self, lead_id, data, **kwargs): - url = 'leads/{}'.format(lead_id) - return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) + url = "leads/{}".format(lead_id) + return self._client._patch(self._client.BASE_URL + url, json=data, **kwargs) def delete_lead(self, lead_id, **kwargs): - url = 'leads/{}'.format(lead_id) + url = "leads/{}".format(lead_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_lead_details(self, lead_id, **kwargs): - url = 'leads/{}'.format(lead_id) + url = "leads/{}".format(lead_id) return self._client._get(self._client.BASE_URL + url, **kwargs) From caf364a0b51cc60f6d390c0fe91e518a72eb92ad Mon Sep 17 00:00:00 2001 From: Miguel Ferrer Date: Wed, 23 Nov 2022 11:22:28 -0500 Subject: [PATCH 06/15] fix: formatting; bump version --- pipedrive/activities.py | 12 ++++----- pipedrive/client.py | 9 ++----- pipedrive/deals.py | 50 ++++++++++++++++++-------------------- pipedrive/filters.py | 10 ++++---- pipedrive/items.py | 4 +-- pipedrive/notes.py | 12 ++++----- pipedrive/organizations.py | 18 +++++++------- pipedrive/persons.py | 18 +++++++------- pipedrive/pipelines.py | 6 ++--- pipedrive/products.py | 16 ++++++------ pipedrive/recents.py | 2 +- pipedrive/stages.py | 12 ++++----- pipedrive/subscriptions.py | 18 +++++++------- pipedrive/users.py | 6 ++--- setup.py | 30 ++++++++++++----------- 15 files changed, 108 insertions(+), 115 deletions(-) diff --git a/pipedrive/activities.py b/pipedrive/activities.py index b630b5e..5b41c6f 100644 --- a/pipedrive/activities.py +++ b/pipedrive/activities.py @@ -3,25 +3,25 @@ def __init__(self, client): self._client = client def get_activity(self, activity_id, **kwargs): - url = 'activities/{}'.format(activity_id) + url = "activities/{}".format(activity_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_activities(self, params=None, **kwargs): - url = 'activities' + url = "activities" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_activity(self, data, **kwargs): - url = 'activities' + url = "activities" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_activity(self, activity_id, data, **kwargs): - url = 'activities/{}'.format(activity_id) + url = "activities/{}".format(activity_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_activity(self, activity_id, **kwargs): - url = 'activities/{}'.format(activity_id) + url = "activities/{}".format(activity_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_activity_fields(self, params=None, **kwargs): - url = 'activityFields' + url = "activityFields" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/client.py b/pipedrive/client.py index eb5f62f..856db91 100644 --- a/pipedrive/client.py +++ b/pipedrive/client.py @@ -116,16 +116,11 @@ def _request(self, method, url, headers=None, params=None, **kwargs): _headers.update(headers) if params: _params.update(params) - return self._parse( - requests.request(method, url, headers=_headers, params=_params, **kwargs) - ) + return self._parse(requests.request(method, url, headers=_headers, params=_params, **kwargs)) def _parse(self, response): status_code = response.status_code - if ( - "Content-Type" in response.headers - and "application/json" in response.headers["Content-Type"] - ): + if "Content-Type" in response.headers and "application/json" in response.headers["Content-Type"]: r = response.json() else: return response.text diff --git a/pipedrive/deals.py b/pipedrive/deals.py index 118d025..d634fdd 100644 --- a/pipedrive/deals.py +++ b/pipedrive/deals.py @@ -3,91 +3,87 @@ def __init__(self, client): self._client = client def get_deal(self, deal_id, **kwargs): - url = 'deals/{}'.format(deal_id) + url = "deals/{}".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_deals(self, params=None, **kwargs): - url = 'deals' + url = "deals" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def get_all_deals_with_filter(self, filter_id, params=None, **kwargs): - url = 'deals?filter_id={}'.format(filter_id) + url = "deals?filter_id={}".format(filter_id) return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_deal(self, data, **kwargs): - url = 'deals' + url = "deals" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_deal(self, deal_id, data, **kwargs): - url = 'deals/{}'.format(deal_id) + url = "deals/{}".format(deal_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_deal(self, deal_id, **kwargs): - url = 'deals/{}'.format(deal_id) + url = "deals/{}".format(deal_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def duplicate_deal(self, deal_id, **kwargs): - url = 'deals/{}/duplicate'.format(deal_id) + url = "deals/{}/duplicate".format(deal_id) return self._client._post(self._client.BASE_URL + url, **kwargs) def get_deal_details(self, deal_id, **kwargs): - url = 'deals/{}'.format(deal_id) + url = "deals/{}".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def search_deals(self, params=None, **kwargs): - url = 'deals/search' + url = "deals/search" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def get_deal_followers(self, deal_id, **kwargs): - url = 'deals/{}/followers'.format(deal_id) + url = "deals/{}/followers".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def add_follower_to_deal(self, deal_id, user_id, **kwargs): - url = 'deals/{}/followers'.format(deal_id) - data = { - 'user_id': user_id - } + url = "deals/{}/followers".format(deal_id) + data = {"user_id": user_id} return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def delete_follower_to_deal(self, deal_id, follower_id, **kwargs): - url = 'deals/{}/followers/{}'.format(deal_id, follower_id) + url = "deals/{}/followers/{}".format(deal_id, follower_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_deal_participants(self, deal_id, **kwargs): - url = 'deals/{}/participants'.format(deal_id) + url = "deals/{}/participants".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def add_participants_to_deal(self, deal_id, person_id, **kwargs): - url = 'deals/{}/participants'.format(deal_id) - data = { - 'person_id': person_id - } + url = "deals/{}/participants".format(deal_id) + data = {"person_id": person_id} return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def delete_participant_to_deal(self, deal_id, participant_id, **kwargs): - url = 'deals/{}/participants/{}'.format(deal_id, participant_id) + url = "deals/{}/participants/{}".format(deal_id, participant_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_deal_activities(self, deal_id, **kwargs): - url = 'deals/{}/activities'.format(deal_id) + url = "deals/{}/activities".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_deal_mail_messages(self, deal_id, **kwargs): - url = 'deals/{}/mailMessages'.format(deal_id) + url = "deals/{}/mailMessages".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_deal_products(self, deal_id, **kwargs): - url = 'deals/{}/products'.format(deal_id) + url = "deals/{}/products".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_deal_fields(self, params=None, **kwargs): - url = 'dealFields' + url = "dealFields" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def add_product_to_deal(self, deal_id, data, **kwargs): - url = 'deals/{}/products'.format(deal_id) + url = "deals/{}/products".format(deal_id) return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def get_deal_updates(self, deal_id, **kwargs): - url = 'deals/{}/flow'.format(deal_id) + url = "deals/{}/flow".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/filters.py b/pipedrive/filters.py index a481db8..8d3d338 100644 --- a/pipedrive/filters.py +++ b/pipedrive/filters.py @@ -3,21 +3,21 @@ def __init__(self, client): self._client = client def get_filter(self, filter_id, **kwargs): - url = 'filters/{}'.format(filter_id) + url = "filters/{}".format(filter_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_filters(self, params=None, **kwargs): - url = 'filters' + url = "filters" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_filter(self, data, **kwargs): - url = 'filters' + url = "filters" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_filter(self, filter_id, data, **kwargs): - url = 'filters/{}'.format(filter_id) + url = "filters/{}".format(filter_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_filter(self, filter_id, **kwargs): - url = 'filters/{}'.format(filter_id) + url = "filters/{}".format(filter_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/items.py b/pipedrive/items.py index c52c98a..124a0a7 100644 --- a/pipedrive/items.py +++ b/pipedrive/items.py @@ -3,5 +3,5 @@ def __init__(self, client): self._client = client def get_item_search(self, params=None, **kwargs): - url = 'itemSearch' - return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) \ No newline at end of file + url = "itemSearch" + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/notes.py b/pipedrive/notes.py index 714ed83..362686d 100644 --- a/pipedrive/notes.py +++ b/pipedrive/notes.py @@ -3,25 +3,25 @@ def __init__(self, client): self._client = client def get_note(self, note_id, **kwargs): - url = 'notes/{}'.format(note_id) + url = "notes/{}".format(note_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_notes(self, params=None, **kwargs): - url = 'notes' + url = "notes" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_note(self, data, **kwargs): - url = 'notes' + url = "notes" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_note(self, note_id, data, **kwargs): - url = 'notes/{}'.format(note_id) + url = "notes/{}".format(note_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_note(self, note_id, **kwargs): - url = 'notes/{}'.format(note_id) + url = "notes/{}".format(note_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_note_fields(self, params=None, **kwargs): - url = 'noteFields' + url = "noteFields" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/organizations.py b/pipedrive/organizations.py index 1c6743a..fed3279 100644 --- a/pipedrive/organizations.py +++ b/pipedrive/organizations.py @@ -3,33 +3,33 @@ def __init__(self, client): self._client = client def get_organization(self, organization_id, **kwargs): - url = 'organizations/{}'.format(organization_id) + url = "organizations/{}".format(organization_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_organizations(self, params=None, **kwargs): - url = 'organizations' + url = "organizations" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_organization(self, data, **kwargs): - url = 'organizations' + url = "organizations" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_organization(self, organization_id, data, **kwargs): - url = 'organizations/{}'.format(organization_id) + url = "organizations/{}".format(organization_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_organization(self, organization_id, **kwargs): - url = 'organizations/{}'.format(organization_id) + url = "organizations/{}".format(organization_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_organization_fields(self, params=None, **kwargs): - url = 'organizationFields' + url = "organizationFields" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def search_organizations(self, params=None, **kwargs): - url = 'organizations/search' + url = "organizations/search" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) - + def get_organization_persons(self, organization_id, params=None, **kwargs): - url = 'organizations/{}/persons'.format(organization_id) + url = "organizations/{}/persons".format(organization_id) return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index 7429d33..0d52bbe 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -3,33 +3,33 @@ def __init__(self, client): self._client = client def get_person(self, person_id, **kwargs): - url = 'persons/{}'.format(person_id) + url = "persons/{}".format(person_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_persons(self, params=None, **kwargs): - url = 'persons' + url = "persons" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def search_persons(self, params=None, **kwargs): - url = 'persons/search' + url = "persons/search" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_person(self, data, **kwargs): - url = 'persons' + url = "persons" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_person(self, person_id, data, **kwargs): - url = 'persons/{}'.format(person_id) + url = "persons/{}".format(person_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_person(self, person_id, **kwargs): - url = 'persons/{}'.format(person_id) + url = "persons/{}".format(person_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_person_deals(self, person_id, **kwargs): - url = 'persons/{}/deals'.format(person_id) + url = "persons/{}/deals".format(person_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_person_fields(self, params=None, **kwargs): - url = 'personFields' - return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) \ No newline at end of file + url = "personFields" + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/pipelines.py b/pipedrive/pipelines.py index 46c44f9..d22b177 100644 --- a/pipedrive/pipelines.py +++ b/pipedrive/pipelines.py @@ -3,13 +3,13 @@ def __init__(self, client): self._client = client def get_pipeline(self, pipeline_id, **kwargs): - url = 'pipelines/{}'.format(pipeline_id) + url = "pipelines/{}".format(pipeline_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_pipelines(self, **kwargs): - url = 'pipelines' + url = "pipelines" return self._client._get(self._client.BASE_URL + url, **kwargs) def get_pipeline_deals(self, pipeline_id, **kwargs): - url = 'pipelines/{}/deals'.format(pipeline_id) + url = "pipelines/{}/deals".format(pipeline_id) return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/products.py b/pipedrive/products.py index db5808e..1eff025 100644 --- a/pipedrive/products.py +++ b/pipedrive/products.py @@ -3,33 +3,33 @@ def __init__(self, client): self._client = client def get_product(self, product_id, **kwargs): - url = 'products/{}'.format(product_id) + url = "products/{}".format(product_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_products(self, **kwargs): - url = 'products' + url = "products" return self._client._get(self._client.BASE_URL + url, **kwargs) def search_products(self, params=None, **kwargs): - url = 'products/search' + url = "products/search" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def create_product(self, data, **kwargs): - url = 'products' + url = "products" return self._client._post(self._client.BASE_URL + url, json=data, **kwargs) def update_product(self, product_id, data, **kwargs): - url = 'products/{}'.format(product_id) + url = "products/{}".format(product_id) return self._client._put(self._client.BASE_URL + url, json=data, **kwargs) def delete_product(self, product_id, **kwargs): - url = 'products/{}'.format(product_id) + url = "products/{}".format(product_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) def get_product_deal(self, product_id, **kwargs): - url = 'products/{}/deals'.format(product_id) + url = "products/{}/deals".format(product_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_product_fields(self, **kwargs): - url = 'productFields' + url = "productFields" return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/recents.py b/pipedrive/recents.py index 9b9e761..3de33b7 100644 --- a/pipedrive/recents.py +++ b/pipedrive/recents.py @@ -3,5 +3,5 @@ def __init__(self, client): self._client = client def get_recent_changes(self, params=None, **kwargs): - url = 'recents' + url = "recents" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) diff --git a/pipedrive/stages.py b/pipedrive/stages.py index 56e3573..57ae854 100644 --- a/pipedrive/stages.py +++ b/pipedrive/stages.py @@ -3,25 +3,25 @@ def __init__(self, client): self._client = client def get_stage(self, stage_id, **kwargs): - url = 'stages/{}'.format(stage_id) + url = "stages/{}".format(stage_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_stages(self, params=None, **kwargs): - url = 'stages' + url = "stages" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) def get_stage_deals(self, stage_id, **kwargs): - url = 'stages/{}/deals'.format(stage_id) + url = "stages/{}/deals".format(stage_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def create_stage(self, data, **kwargs): - url = 'stages' + url = "stages" return self._client._post(self._client.BASE_URL + url, data, **kwargs) def update_stage(self, stage_id, data, **kwargs): - url = 'stages/{}'.format(stage_id) + url = "stages/{}".format(stage_id) return self._client._put(self._client.BASE_URL + url, data, **kwargs) def delete_stage(self, stage_id, **kwargs): - url = 'stages/{}'.format(stage_id) + url = "stages/{}".format(stage_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/subscriptions.py b/pipedrive/subscriptions.py index feb8cae..d368f1d 100644 --- a/pipedrive/subscriptions.py +++ b/pipedrive/subscriptions.py @@ -3,37 +3,37 @@ def __init__(self, client): self._client = client def get_subscription(self, subscription_id, **kwargs): - url = 'subscriptions/{}'.format(subscription_id) + url = "subscriptions/{}".format(subscription_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_deal_subscription(self, deal_id, **kwargs): - url = 'subscriptions/find/{}'.format(deal_id) + url = "subscriptions/find/{}".format(deal_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_payments(self, subscription_id, **kwargs): - url = 'subscriptions/{}/payments'.format(subscription_id) + url = "subscriptions/{}/payments".format(subscription_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def add_recurring_subscription(self, data, **kwargs): - url = 'subscriptions/recurring' + url = "subscriptions/recurring" return self._client._post(self._client.BASE_URL + url, data, **kwargs) def add_installment_subscription(self, data, **kwargs): - url = 'subscriptions/installment' + url = "subscriptions/installment" return self._client._post(self._client.BASE_URL + url, data, **kwargs) def update_recurring_subscription(self, subscription_id, data, **kwargs): - url = 'subscriptions/recurring/{}'.format(subscription_id) + url = "subscriptions/recurring/{}".format(subscription_id) return self._client._put(self._client.base_url + url, data, **kwargs) def update_installment_subscription(self, subscription_id, data, **kwargs): - url = 'subscriptions/installment/{}'.format(subscription_id) + url = "subscriptions/installment/{}".format(subscription_id) return self._client._put(self._client.base_url + url, data, **kwargs) def cancel_recurring_subscription(self, subscription_id, data, **kwargs): - url = 'subscriptions/recurring/{}/cancel'.format(subscription_id) + url = "subscriptions/recurring/{}/cancel".format(subscription_id) return self._client._put(self._client.base_url + url, data, **kwargs) def delete_subscription(self, subscription_id, **kwargs): - url = 'subscriptions/{}'.format(subscription_id) + url = "subscriptions/{}".format(subscription_id) return self._client._delete(self._client.BASE_URL + url, **kwargs) diff --git a/pipedrive/users.py b/pipedrive/users.py index 3eb7ee4..fee6b79 100644 --- a/pipedrive/users.py +++ b/pipedrive/users.py @@ -3,13 +3,13 @@ def __init__(self, client): self._client = client def get_user(self, user_id, **kwargs): - url = 'users/{}'.format(user_id) + url = "users/{}".format(user_id) return self._client._get(self._client.BASE_URL + url, **kwargs) def get_all_users(self, **kwargs): - url = 'users' + url = "users" return self._client._get(self._client.BASE_URL + url, **kwargs) def get_me(self, **kwargs): - url = 'users/me' + url = "users/me" return self._client._get(self._client.BASE_URL + url, **kwargs) diff --git a/setup.py b/setup.py index 5673c5a..631dc97 100644 --- a/setup.py +++ b/setup.py @@ -6,17 +6,19 @@ def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() -setup(name='pipedrive-python-lib', - version='1.1.5', - description='API wrapper for Pipedrive written in Python', - long_description=read('README.md'), - long_description_content_type="text/markdown", - url='https://github.com/GearPlug/pipedrive-python', - author='Miguel Ferrer', - author_email='ingferrermiguel@gmail.com', - license='MIT', - packages=['pipedrive'], - install_requires=[ - 'requests', - ], - zip_safe=False) +setup( + name="pipedrive-python-lib", + version="1.2.0", + description="API wrapper for Pipedrive written in Python", + long_description=read("README.md"), + long_description_content_type="text/markdown", + url="https://github.com/GearPlug/pipedrive-python", + author="Miguel Ferrer", + author_email="ingferrermiguel@gmail.com", + license="MIT", + packages=["pipedrive"], + install_requires=[ + "requests", + ], + zip_safe=False, +) From ea1700689c8d1b42c9233b14c7173f966c21c99d Mon Sep 17 00:00:00 2001 From: polux Date: Mon, 9 Jan 2023 11:39:48 -0300 Subject: [PATCH 07/15] get_persons_activities() added to function list --- pipedrive/persons.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index 0d52bbe..ead4399 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -33,3 +33,7 @@ def get_person_deals(self, person_id, **kwargs): def get_person_fields(self, params=None, **kwargs): url = "personFields" return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + + def get_person_activities(self, person_id, **kwargs): + url = "persons/{}/activities".format(person_id) + return self._client._get(self._client.BASE_URL + url, **kwargs) From 273b61bb65a3de325fe46dcbb651ea88444bef57 Mon Sep 17 00:00:00 2001 From: Miguel Ferrer Date: Mon, 30 Jan 2023 09:14:13 -0500 Subject: [PATCH 08/15] bump ver --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 631dc97..498f8c4 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ def read(fname): setup( name="pipedrive-python-lib", - version="1.2.0", + version="1.2.1", description="API wrapper for Pipedrive written in Python", long_description=read("README.md"), long_description_content_type="text/markdown", From dd3979b79fba52592bc2f326b8e9a5c995bda3b2 Mon Sep 17 00:00:00 2001 From: Miguel Ferrer Date: Mon, 27 Mar 2023 15:48:04 -0500 Subject: [PATCH 09/15] feat: pyproject.toml --- pyproject.toml | 18 ++++++++++++++++++ setup.py | 24 ------------------------ 2 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..dcd6287 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "pipedrive-python-lib" +version = "1.2.2" +description = "API wrapper for Pipedrive written in Python" +authors = ["Miguel Ferrer "] +license = "MIT" +readme = "README.md" +packages = [{include = "pipedrive"}] + +[tool.poetry.dependencies] +python = "^3.7" +requests = "^2.26.0" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + diff --git a/setup.py b/setup.py deleted file mode 100644 index 498f8c4..0000000 --- a/setup.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -from setuptools import setup - - -def read(fname): - return open(os.path.join(os.path.dirname(__file__), fname)).read() - - -setup( - name="pipedrive-python-lib", - version="1.2.1", - description="API wrapper for Pipedrive written in Python", - long_description=read("README.md"), - long_description_content_type="text/markdown", - url="https://github.com/GearPlug/pipedrive-python", - author="Miguel Ferrer", - author_email="ingferrermiguel@gmail.com", - license="MIT", - packages=["pipedrive"], - install_requires=[ - "requests", - ], - zip_safe=False, -) From 2d44053f08e8a128d4521a29d11ecf29b4fb6644 Mon Sep 17 00:00:00 2001 From: martin sarsale Date: Fri, 23 Jun 2023 11:03:58 -0300 Subject: [PATCH 10/15] Update README.md Fixes URLs in Pipedrive API docs --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 616f759..0092091 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ client.set_api_token('API_TOKEN') ### Activities -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Activities +API docs: https://developers.pipedrive.com/docs/api/v1/Activities #### Get an activity ``` @@ -96,7 +96,7 @@ response = client.activities.get_activity_fields() ### Deals -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Deals +API docs: https://developers.pipedrive.com/docs/api/v1/Deals #### Get a deal ``` @@ -209,7 +209,7 @@ response = client.deals.get_deal_updates('DEAL_ID') ### Filters -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Filters +API docs: https://developers.pipedrive.com/docs/api/v1/Filters #### Get a filter ``` @@ -248,7 +248,7 @@ response = client.filters.delete_filter('FILTER_ID') ### Notes -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Notes +API docs: https://developers.pipedrive.com/docs/api/v1/Notes #### Get a note ``` @@ -288,7 +288,7 @@ response = client.notes.get_note_fields() ### Organizations -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Organizations +API docs: https://developers.pipedrive.com/docs/api/v1/Organizations #### Get an organization ``` @@ -336,7 +336,7 @@ response = client.organizations.get_organization_fields() ### Persons -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Persons +API docs: https://developers.pipedrive.com/docs/api/v1/Persons #### Get a person ``` @@ -389,7 +389,7 @@ response = client.persons.get_person_fields() ### Pipelines -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Pipelines +API docs: https://developers.pipedrive.com/docs/api/v1/Pipelines #### Get a pipeline ``` @@ -408,7 +408,7 @@ response = client.pipelines.get_pipeline_deals() ### Products -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Products +API docs: https://developers.pipedrive.com/docs/api/v1/Products #### Get a product ``` @@ -471,7 +471,7 @@ response = client.recents.get_recent_changes(params=params) ### Users -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Users +API docs: https://developers.pipedrive.com/docs/api/v1/Users #### Get an user ``` @@ -490,7 +490,7 @@ response = client.users.get_me() ### Webhook -API docs: https://developers.pipedrive.com/docs/api/v1/#!/Webhooks +API docs: https://developers.pipedrive.com/docs/api/v1/Webhooks #### Get webhooks ``` From 0e3c7f41fbc3c2d1e2a447d38c2632f0ca29e90b Mon Sep 17 00:00:00 2001 From: Nikita Pokidyshev Date: Wed, 27 Sep 2023 19:53:12 +0300 Subject: [PATCH 11/15] Add search_leads --- pipedrive/leads.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pipedrive/leads.py b/pipedrive/leads.py index 9ea9802..2efe4f2 100644 --- a/pipedrive/leads.py +++ b/pipedrive/leads.py @@ -25,3 +25,7 @@ def delete_lead(self, lead_id, **kwargs): def get_lead_details(self, lead_id, **kwargs): url = "leads/{}".format(lead_id) return self._client._get(self._client.BASE_URL + url, **kwargs) + + def search_leads(self, params=None, **kwargs): + url = "leads/search" + return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) From fdd447edc949f9ceaff628313dcfb8ad2e475abc Mon Sep 17 00:00:00 2001 From: Juan Date: Fri, 29 Sep 2023 12:22:32 -0500 Subject: [PATCH 12/15] readme leads and fixes --- README.md | 159 ++++++++++++++++++++++++++----------------------- pyproject.toml | 2 +- 2 files changed, 87 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 0092091..f6b5ebe 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # pipedrive-python - -pipedrive-python is an API wrapper for [Pipedrive](https://www.pipedrive.com/) written in Python. +![](https://img.shields.io/badge/version-1.2.3-success) ![](https://img.shields.io/badge/Python-3.8%20|%203.9%20|%203.10%20|%203.11-4B8BBE?logo=python&logoColor=white) +*pipedrive-python* is an API wrapper for [Pipedrive](https://www.pipedrive.com/) written in Python. ## Installing ``` @@ -12,43 +12,43 @@ pip install pipedrive-python-lib ### Using this library with OAuth 2.0 #### Client instantiation -``` +```python from pipedrive.client import Client client = Client('CLIENT_ID', 'CLIENT_SECRET') ``` #### Get authorization url -``` +```python url = client.authorization_url('REDIRECT_URL') ``` #### Exchange the code for an access token -``` +```python token = client.exchange_code('REDIRECT_URL', 'CODE') ``` #### Set access token in the library -``` +```python client.set_access_token('ACCESS_TOKEN') ``` #### Refresh token -``` +```python token = client.refresh_token('REFRESH_TOKEN') ``` ### Using this library with API Token #### Client instantiation -``` +```python from pipedrive.client import Client client = Client(domain='https://companydomain.pipedrive.com/') ``` #### Set API token in the library -``` +```python client.set_api_token('API_TOKEN') ``` @@ -57,17 +57,17 @@ client.set_api_token('API_TOKEN') API docs: https://developers.pipedrive.com/docs/api/v1/Activities #### Get an activity -``` +```python response = client.activities.get_activity('ACTIVITY_ID') ``` #### Get all activities -``` +```python response = client.activities.get_all_activities() ``` #### Create an activity -``` +```python data = { 'subject': '', 'type': '' @@ -76,7 +76,7 @@ response = client.activities.create_activity(data) ``` #### Update an activity -``` +```python data = { 'subject': '', 'type': '' @@ -85,12 +85,12 @@ response = client.activities.update_activity('ACTIVITY_ID', data) ``` #### Delete an activity -``` +```python response = client.activities.delete_activity('ACTIVITY_ID') ``` #### Get activity fields -``` +```python response = client.activities.get_activity_fields() ``` @@ -99,22 +99,22 @@ response = client.activities.get_activity_fields() API docs: https://developers.pipedrive.com/docs/api/v1/Deals #### Get a deal -``` +```python response = client.deals.get_deal('DEAL_ID') ``` #### Get all deals -``` +```python response = client.deals.get_all_deals() ``` #### Get all deals based on filter -``` +```python response = client.deals.get_all_deals_with_filter('FILTER_ID') ``` #### Create deal -``` +```python data = { 'title': '' } @@ -122,7 +122,7 @@ response = client.deals.create_deal(data) ``` #### Update deal -``` +```python data = { 'title': '' } @@ -130,22 +130,22 @@ response = client.deals.update_deal('DEAL_ID', data) ``` #### Delete deal -``` +```python response = client.deals.delete_deal('DEAL_ID') ``` #### Duplicate deal -``` +```python response = client.deals.duplicate_deal('DEAL_ID') ``` #### Get details of a deal -``` +```python response = client.deals.get_deal_details('DEAL_ID') ``` #### Search deals -``` +```python params = { 'term': '' } @@ -153,57 +153,57 @@ response = client.deals.search_deals(params=params) ``` #### Get followers of a deal -``` +```python response = client.deals.get_deal_followers('DEAL_ID') ``` #### Add a follower to a deal -``` +```python response = client.deals.add_follower_to_deal('DEAL_ID', 'USER_ID') ``` #### Delete a follower from a deal -``` +```python response = client.deals.delete_follower_to_deal('DEAL_ID', 'FOLLOWER_ID') ``` #### Get participants of a deal -``` +```python response = client.deals.get_deal_participants('DEAL_ID') ``` #### Add a participant to a deal -``` +```python response = client.deals.add_participants_to_deal('DEAL_ID', 'PERSON_ID') ``` #### Delete a participant from a deal -``` +```python response = client.deals.delete_participant_to_deal('DEAL_ID', 'PARTICIPANT_ID') ``` #### Get activities associated with a deal -``` +```python response = client.deals.get_deal_activities('DEAL_ID') ``` #### Get mail messages associated with a deal -``` +```python response = client.deals.get_deal_mail_messages('DEAL_ID') ``` #### Get products attached to a deal -``` +```python response = client.deals.get_deal_products('DEAL_ID') ``` #### Get deal fields -``` +```python response = client.deals.get_deal_fields() ``` #### Get updates of a deal -``` +```python response = client.deals.get_deal_updates('DEAL_ID') ``` @@ -212,17 +212,17 @@ response = client.deals.get_deal_updates('DEAL_ID') API docs: https://developers.pipedrive.com/docs/api/v1/Filters #### Get a filter -``` +```python response = client.filters.get_filter('FILTER_ID') ``` #### Get all filters -``` +```python response = client.filters.get_all_filters() ``` #### Create filter -``` +```python data = { 'name': '', 'conditions': {}, @@ -232,7 +232,7 @@ response = client.filters.create_filter(data) ``` #### Update filter -``` +```python data = { 'name': '', 'conditions': {}, @@ -242,7 +242,7 @@ response = client.filters.update_filter('FILTER_ID', data) ``` #### Delete filter -``` +```python response = client.filters.delete_filter('FILTER_ID') ``` @@ -251,17 +251,17 @@ response = client.filters.delete_filter('FILTER_ID') API docs: https://developers.pipedrive.com/docs/api/v1/Notes #### Get a note -``` +```python response = client.notes.get_note('NOTE_ID') ``` #### Get all notes -``` +```python response = client.notes.get_all_notes() ``` #### Add a note -``` +```python data = { 'content': '' } @@ -269,7 +269,7 @@ response = client.notes.create_note(data) ``` #### Update a note -``` +```python data = { 'content': '' } @@ -277,12 +277,12 @@ response = client.notes.update_note('NOTE_ID', data) ``` #### Delete a note -``` +```python response = client.notes.delete_note('NOTE_ID') ``` #### Get note fields -``` +```python response = client.notes.get_note_fields() ``` @@ -291,17 +291,17 @@ response = client.notes.get_note_fields() API docs: https://developers.pipedrive.com/docs/api/v1/Organizations #### Get an organization -``` +```python response = client.organizations.get_organization('ORGANIZATION_ID') ``` #### Get all organizations -``` +```python response = client.organizations.get_all_organizations() ``` #### Search organizations -``` +```python params = { 'term': '' } @@ -309,7 +309,7 @@ response = client.products.search_organizations(params=params) ``` #### Add organization -``` +```python data = { 'name': '' } @@ -317,7 +317,7 @@ response = client.organizations.create_organization(data) ``` #### Update organization -``` +```python data = { 'name': '' } @@ -325,12 +325,12 @@ response = client.organizations.update_organization('ORGANIZATION_ID', data) ``` #### Delete an organization -``` +```python response = client.organizations.delete_organization('ORGANIZATION_ID') ``` #### Get organization fields -``` +```python response = client.organizations.get_organization_fields() ``` @@ -339,17 +339,17 @@ response = client.organizations.get_organization_fields() API docs: https://developers.pipedrive.com/docs/api/v1/Persons #### Get a person -``` +```python response = client.persons.get_person('PERSON_ID') ``` #### Get all persons -``` +```python response = client.persons.get_all_persons() ``` #### Search persons -``` +```python params = { 'term': '' } @@ -357,7 +357,7 @@ response = client.persons.search_persons(params=params) ``` #### Create person -``` +```python data = { 'name': '' } @@ -365,7 +365,7 @@ response = client.persons.create_person(data) ``` #### Update person -``` +```python data = { 'name': '' } @@ -373,17 +373,17 @@ response = client.persons.update_person('PERSON_ID', data) ``` #### Delete person -``` +```python response = client.persons.delete_person('PERSON_ID') ``` #### Get deals associated with a person -``` +```python response = client.persons.get_person_deals('PERSON_ID') ``` #### Get person fields -``` +```python response = client.persons.get_person_fields() ``` @@ -392,17 +392,17 @@ response = client.persons.get_person_fields() API docs: https://developers.pipedrive.com/docs/api/v1/Pipelines #### Get a pipeline -``` +```python response = client.pipelines.get_pipeline('PIPELINE_ID') ``` #### Get all pipelines -``` +```python response = client.pipelines.get_all_pipelines() ``` #### Get deals attached to a pipeline -``` +```python response = client.pipelines.get_pipeline_deals() ``` @@ -411,17 +411,17 @@ response = client.pipelines.get_pipeline_deals() API docs: https://developers.pipedrive.com/docs/api/v1/Products #### Get a product -``` +```python response = client.products.get_product('PRODUCT_ID') ``` #### Get all products -``` +```python response = client.products.get_all_products() ``` #### Search products -``` +```python params = { 'term': '' } @@ -429,7 +429,7 @@ response = client.products.search_products(params=params) ``` #### Create a product -``` +```python data = { 'name': '' } @@ -437,7 +437,7 @@ response = client.products.create_product(data) ``` #### Update a product -``` +```python data = { 'name': '' } @@ -445,30 +445,43 @@ response = client.products.update_product('PRODUCT_ID', data) ``` #### Delete a product -``` +```python response = client.products.delete_product('PRODUCT_ID') ``` #### Get deals where a product is attached to -``` +```python response = client.products.get_product_deal('PRODUCT_ID') ``` #### Get product fields -``` +```python response = client.products.get_product_fields() ``` ### Recents #### Get recent changes -``` +```python params = { 'since_timestamp': 'YYYY-MM-DD HH:MM:SS' } response = client.recents.get_recent_changes(params=params) ``` +### Leads +API docs: https://developers.pipedrive.com/docs/api/v1/Leads +#### Get a lead +```python +response = client.leads.get_lead('LEAD_ID') +``` +#### Search leads +```python +params = { + 'term': '' +} +response = client.leads.search_leads(params=params) +``` ### Users API docs: https://developers.pipedrive.com/docs/api/v1/Users diff --git a/pyproject.toml b/pyproject.toml index dcd6287..0eab7cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pipedrive-python-lib" -version = "1.2.2" +version = "1.2.3" description = "API wrapper for Pipedrive written in Python" authors = ["Miguel Ferrer "] license = "MIT" From d190673b0ae3d0272e379712dcf885b605f4167d Mon Sep 17 00:00:00 2001 From: Ape Toshi Date: Thu, 26 Oct 2023 20:28:41 +0200 Subject: [PATCH 13/15] Add add_follower_to_person --- pipedrive/persons.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index ead4399..ce92945 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -37,3 +37,8 @@ def get_person_fields(self, params=None, **kwargs): def get_person_activities(self, person_id, **kwargs): url = "persons/{}/activities".format(person_id) return self._client._get(self._client.BASE_URL + url, **kwargs) + + def add_follower_to_person(self, person_id, user_id, **kwargs): + url = "persons/{}/followers".format(person_id) + data = {'user_id': user_id} + return self.client._post(self.BASE_URL+url, json=data, **kwargs) From f25b6f2fe904bf7afd13297179a3965514c95a45 Mon Sep 17 00:00:00 2001 From: Ape Toshi Date: Thu, 26 Oct 2023 20:33:47 +0200 Subject: [PATCH 14/15] Changed single to double quotes --- pipedrive/persons.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipedrive/persons.py b/pipedrive/persons.py index ce92945..5d7f615 100644 --- a/pipedrive/persons.py +++ b/pipedrive/persons.py @@ -40,5 +40,5 @@ def get_person_activities(self, person_id, **kwargs): def add_follower_to_person(self, person_id, user_id, **kwargs): url = "persons/{}/followers".format(person_id) - data = {'user_id': user_id} + data = {"user_id": user_id} return self.client._post(self.BASE_URL+url, json=data, **kwargs) From ffd556ab3749f0da8db0c6f8e029a3a3b3ec2469 Mon Sep 17 00:00:00 2001 From: Ape Toshi Date: Thu, 26 Oct 2023 20:43:48 +0200 Subject: [PATCH 15/15] Add add_follower_to_organization --- pipedrive/organizations.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pipedrive/organizations.py b/pipedrive/organizations.py index fed3279..193d491 100644 --- a/pipedrive/organizations.py +++ b/pipedrive/organizations.py @@ -33,3 +33,8 @@ def search_organizations(self, params=None, **kwargs): def get_organization_persons(self, organization_id, params=None, **kwargs): url = "organizations/{}/persons".format(organization_id) return self._client._get(self._client.BASE_URL + url, params=params, **kwargs) + + def add_follower_to_organization(self, org_id, user_id, **kwargs): + url = "organizations/{}/followers".format(org_id) + data = {"user_id": user_id} + return self._post(self.BASE_URL+url, json=data, **kwargs)