0

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

  • For the issue 46 discussion of PyPardot4 (I suggested a solution in the thread), I forked it to create PyPardotSF that includes the flow to obtain the refresh token. PyPardotSF also supports Ver 3 API: https://github.com/anelendata/PyPardotSF (not enough reputation on stackoverflow to comment in the previous thread :p ) – Daigo Mar 05 '21 at 17:39

3 Answers3

0

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.

Ilya Berdichevsky
  • 1,249
  • 10
  • 24
  • lily, thanks for sharing the details. I was trying to authenticate my login using the code below. But I can't login directly through Pardot account as we are using salesforce authentication. Do you know any workaround to login using salesforce to Pardot. below is the python code I was using:- from pypardot.client import PardotAPI p = PardotAPI( email='email@email.com', password='password', user_key='userkey' ) p.authenticate() This results in "False" for authentication when executed. Thanks and I really appreciate your response – user14955184 Jan 09 '21 at 21:07
  • Looks like this option will stop working soon. For more details and possible workaround see these links: https://developer.pardot.com/kb/authentication/, https://github.com/mneedham91/PyPardot4/issues/46, https://github.com/anelendata/PyPardot4/commit/bef7422f5dfbfc1ca30b73cc22bd9a89352d1ed8 – Ilya Berdichevsky Jan 09 '21 at 22:10
0

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 ={})
lzpup
  • 31
  • 1
0

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.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/32454200) – rachwa Aug 15 '22 at 11:05