Skip to content

Commit 6511e62

Browse files
author
Yordy Gelvez
committed
improvements in main instance
1 parent bac57cc commit 6511e62

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ git+git://github.com/GearPlug/pipedrive-python
77
```
88

99
## Usage
10-
- If you are not going to use the authentication flow, just instance the library like this:
10+
- If you are not going to use the authentication flow, just send the "pipedrive company domain" and instance the library like this:
1111
```
1212
from pipedrive.client import Client
13-
client = Client()
13+
client = Client(api_base_url='https://companydomain.pipedrive.com/')
1414
```
15-
- If on the contrary you will use it, send the "client_id", the "client secret" and the paramater "oauth=True" in the main instance like this:
15+
16+
- If on the contrary you will use it, send the "pipedrive company domain", the "client_id", the "client secret" and the parameter "oauth=True" in the main instance like this:
1617
```
1718
from pipedrive.client import Client
18-
client = Client('CLIENT_ID', 'CLIENT_SECRET', oauth=True)
19+
client = Client(api_base_url='https://companydomain.pipedrive.com/', 'CLIENT_ID', 'CLIENT_SECRET', oauth=True)
1920
```
2021

2122
#### Set token

pipedrive/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ class Client:
77
flow_base_url = "https://oauth.pipedrive.com/oauth/"
88
oauth_end = "authorize?"
99
token_end = "token"
10-
api_base_url = "https://companydomain.pipedrive.com/"
1110
api_version = "v1/"
1211
header = {"Accept": "application/json, */*", "content-type": "application/json"}
1312

14-
def __init__(self, client_id=None, client_secret=None, oauth=False):
13+
def __init__(self, api_base_url, client_id=None, client_secret=None, oauth=False):
1514
self.client_id = client_id
1615
self.client_secret = client_secret
1716
self.oauth = oauth
17+
self.api_base_url = api_base_url
1818
self.token = None
1919

2020
def make_request(self, method, endpoint, data=None, json=None, **kwargs):

pipedrive/test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from pipedrive.client import Client
1+
from pipedrive.client import Client
2+
3+
client = Client(api_base_url="https://companydomain.pipedrive.com/")

0 commit comments

Comments
 (0)