mneedham91 / PyPardot4

PyPardot is a wrapper for Version 4 of the Pardot API, written in Python.
MIT License
48 stars 38 forks source link

Auth Requirements Changed. use POST for query and add auth to body, not param #24

Closed dishwasher closed 3 years ago

dishwasher commented 5 years ago

hey @mneedham91 sorry for lack of details, figured code was a better demonstration.

See here: https://github.com/mneedham91/PyPardot4/pull/25

Prior to it, was getting PardotAPIError: Error #49: Access Denied

crakage commented 5 years ago

Hi there, I believe the issue is not fixed for every object, I am still getting the Error 49 when trying to user p.account.read() for example.

I am terrible at Python but I have the impression that the code is still passing the parameter with the URL instead of passing them in the body of the request.

I have tried to create a request manually and it works, could double check that your update was applied to all the objects? Thanks

`# importing the requests library import requests

defining the api-endpoint

API_ENDPOINT = "http://pi.pardot.com/api/account/version/4/do/read"

your API key here

user_key = "xxxxx" api_key = "xxxxx"

your source code here

data to be sent to api

data = {'user_key': user_key, 'api_key': api_key, }

sending post request and saving response as response object

r = requests.post(url=API_ENDPOINT, data=data)

extracting response text

response = r.text print(response)`