Is there any way to export data from pardot using python?
Question:
Currently its a manual process as mentioned below in the link:
https://help.salesforce.com/articleView?id=pardot_export_prospects.htm&type=5
Can we use python to fetch data instead of doing manual work? Please share an example of the code
Answers:
Use Official Pardot API Documentation and PyPardot – Python API wrapper for Pardot.
See querying objects for code example and querying prospects section of API docs for supported operations.
Review the developer docs shared above and this doc: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_oauth_and_connected_apps.htm , setup the connected app. Then retrieve the token using the keys and business unit
then use the token to grab what you are looking for using the pardot api
response = requests.post(auth_url, data = {
'client_id':client_id,
'client_secret':client_secret,
'grant_type':'password',
'username':sfdc_user,
'password':sfdc_pass
})
print (response)
# Retrieve token
json_res = response.json()
access_token = json_res['access_token']
#print(access_token)
auth = {'Authorization':'Bearer ' + access_token,'Pardot-Business-Unit-Id':sfdc_buid}
response = requests.post(listmember_uri, headers=auth,data ={})
I was trying to do so but found out that as of February 1, 2021, Pardot will no longer accept userkey, password, and username combinations for Pardot API authentication.
Currently its a manual process as mentioned below in the link:
https://help.salesforce.com/articleView?id=pardot_export_prospects.htm&type=5
Can we use python to fetch data instead of doing manual work? Please share an example of the code
Use Official Pardot API Documentation and PyPardot – Python API wrapper for Pardot.
See querying objects for code example and querying prospects section of API docs for supported operations.
Review the developer docs shared above and this doc: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_oauth_and_connected_apps.htm , setup the connected app. Then retrieve the token using the keys and business unit
then use the token to grab what you are looking for using the pardot api
response = requests.post(auth_url, data = {
'client_id':client_id,
'client_secret':client_secret,
'grant_type':'password',
'username':sfdc_user,
'password':sfdc_pass
})
print (response)
# Retrieve token
json_res = response.json()
access_token = json_res['access_token']
#print(access_token)
auth = {'Authorization':'Bearer ' + access_token,'Pardot-Business-Unit-Id':sfdc_buid}
response = requests.post(listmember_uri, headers=auth,data ={})
I was trying to do so but found out that as of February 1, 2021, Pardot will no longer accept userkey, password, and username combinations for Pardot API authentication.