Skip to content

Commit

Permalink
improvements in main instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Yordy Gelvez committed Feb 26, 2018
1 parent bac57cc commit 6511e62
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ git+git://github.com/GearPlug/pipedrive-python
```

## Usage
- If you are not going to use the authentication flow, just instance the library like this:
- If you are not going to use the authentication flow, just send the "pipedrive company domain" and instance the library like this:
```
from pipedrive.client import Client
client = Client()
client = Client(api_base_url='https://companydomain.pipedrive.com/')
```
- 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:

- 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:
```
from pipedrive.client import Client
client = Client('CLIENT_ID', 'CLIENT_SECRET', oauth=True)
client = Client(api_base_url='https://companydomain.pipedrive.com/', 'CLIENT_ID', 'CLIENT_SECRET', oauth=True)
```

#### Set token
Expand Down
4 changes: 2 additions & 2 deletions pipedrive/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class Client:
flow_base_url = "https://oauth.pipedrive.com/oauth/"
oauth_end = "authorize?"
token_end = "token"
api_base_url = "https://companydomain.pipedrive.com/"
api_version = "v1/"
header = {"Accept": "application/json, */*", "content-type": "application/json"}

def __init__(self, client_id=None, client_secret=None, oauth=False):
def __init__(self, api_base_url, client_id=None, client_secret=None, oauth=False):
self.client_id = client_id
self.client_secret = client_secret
self.oauth = oauth
self.api_base_url = api_base_url
self.token = None

def make_request(self, method, endpoint, data=None, json=None, **kwargs):
Expand Down
4 changes: 3 additions & 1 deletion pipedrive/test.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from pipedrive.client import Client
from pipedrive.client import Client

client = Client(api_base_url="https://companydomain.pipedrive.com/")

0 comments on commit 6511e62

Please sign in to comment.