mneedham91 / PyPardot4

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

Cannot use output='bulk' #11

Closed catalandres closed 6 years ago

catalandres commented 7 years ago

Trying this:

p.visits.query_by_prospect_ids(
             prospect_ids=prospect,
             sort_by='created_at',
             sort_order='ascending',
             output='bulk')

returns this:

File "/usr/local/lib/python3.6/site-packages/pypardot/objects/visits.py", line 51, in query_by_prospect_ids
    if result['total_results'] == 0:
KeyError: 'total_results'

As per Pardot's documentation, this option "returns basic data for an object (does not provide total object count). Used for querying large amounts of data."

If the option output='bulk' is entered, the code should not rely in the return of the key total_results, because it won't be there.

mneedham91 commented 6 years ago

This was resolved in latest commit thanks to @swkasula

zhar97 commented 4 years ago

I noticed that @mneedham91 has declared this issue closed after @swkasula's latest commit. But, I still encountered the problem.