-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-zoho-crm-api.py
More file actions
24 lines (21 loc) · 874 Bytes
/
Copy pathtest-zoho-crm-api.py
File metadata and controls
24 lines (21 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from zcrmsdk import ZCRMRecord,ZCRMRestClient,ZohoOAuth,ZCRMModule
config = { 'currentUserEmail':'YOUR_ZOHO_EMAIL',
'sandbox':'False',
'applicationLogFilePath':'./log',
'client_id':'YOUR_CLIENT_ID',
'client_secret':'YOUR_CLIENT_SECRET',
'redirect_uri':'YOUR_REDIRECT_URI',
'accounts_url':'YOUR_ACCOUNTS_URL',
'token_persistence_path':"."}
ZCRMRestClient.initialize(config)
oauth_client = ZohoOAuth.get_client_instance()
grant_token = "Authorization_Grant_Code"
oauth_tokens = oauth_client.generate_access_token(grant_token)
print(oauth_tokens)
record = ZCRMRecord.get_instance('Leads',id)
resp = record.get()
print(resp.data.field_data['Email'])
module_ins = ZCRMModule.get_instance('Leads')
resp=module_ins.get_records(page=3,per_page=100)
for records in resp.data:
print(records)