GithubHelp home page GithubHelp logo

pypardot4's People

Contributors

bernardito-luis avatar besteman avatar cjwright83 avatar delirious-lettuce avatar dishwasher avatar mneedham91 avatar sagiyosefia avatar siddyp avatar whitespaceninja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pypardot4's Issues

Test and document v3 compatibility

Compatibility for version 3 of the Pardot API was allowed in most recent commit (also now live on PyPi). However I have not tested it (maybe in poor form but the change left everything intact for version 4). I also not have added documentation to the wiki.

Pardot authentication after spring 2021

As per pardot documentation, "In the Spring '21 and later releases of the Pardot API, authentication with the API key / user key will not be supported".

How does pypardot4 is going to me impacted with this?

Question on Visitor page view

Hi,

I have a requirement to fetch the Visitor page view objects by using key "visitor_page_view_id" from visitor activity object. Seems that we don't have a direct API object to fetch visitor page view objects.
Can you please help me in finding the right object to fetch visitor page view objects.
Thank you.

Regards,
Surendhar

Campaign not updated when email sent

I have created a campaign within pardot. I pass the campaign id through to the send_to_email() function, which sends the email. But when I check the campaign in the web page, it doesn't show any history/data of the email being sent.

from pypardot.client import PardotAPI


class HandlePardotEmails():
    
    def __init__(self):
        self.dev_email = '[email protected]'
        self.pw = 'some_pass'
        self.api_key = 'some_key'
        self.p = PardotAPI(
                    email=self.dev_email,
                    password=self.pw,
                    user_key=self.api_key
                    )
                    
        self.p.authenticate()

    
    def pardot_emails(self, user_email, raw_email, f_name, l_name, full_name, sub, camp_id):
        self.user_email = user_email
        self.raw_email = raw_email
        self.f_name = f_name
        self.l_name = l_name
        self.full_name = full_name
        self.sub = sub
        #send email
        self.prospect = self.p.prospects.create(email=self.user_email, 
                                                first_name = self.f_name, 
                                                last_name = self.l_name)
        self.user_info = self.prospect['prospect']
        self.camp_id = camp_id#self.user_info['campaign_id']
        self.email_content = str(self.raw_email) 
        self.p.emails.send_to_email(campaign_id=self.camp_id, 
                               prospect_email=self.user_email,
                               name=self.full_name, subject=self.sub,
                               from_email='[email protected]',
                               from_name='Marketing - Campaign',
                               text_content='%%unsubscribe%%',
                               html_content=self.email_content)

And I call it like so;

    par.pardot_emails(row['Email'], formatted_template, row['FirstName'], row['Surname'], row['FullName'], 'Subject', 55859)

Handling of 'total_results' in query works improperly.

I have looked at the code for the query method in both prospects.py and tagobjects.py and it has the following structure to ensure that a consistent list representation of the records returned is returned from the query. I agree this is a very good idea.

However, it appears to be misinterpreting the meaning of the total_results key in the result and consequently does not operate as I think it was intended:

        # Ensure result['tagObject'] is a list, no matter what.
        result = response.get('result')
        if result['total_results'] == 0:
            result['tagObject'] = []
        elif result['total_results'] == 1:
            result['tagObject'] = [result['tagObject']]

        return result

This is treating the value associated with total_results as if it represented the length of the response. However, from my experiments, this only holds true for when the results are less than the maximum page size of 200. My documentation describes total_results as:

Contains the number of tagObjects selected by this query. If this value is higher than 200, then several query requests may be necessary to retrieve all of the matched tagObjects

My interpretation is that it is passing along how many total records are associated with the query, even though there may only be up to 200 of those records included in any actual query. This allows the calling code to continue querying the data at various offsets to collect the full results.

The code correctly identifies that there are three conditions of data being returned, but incorrectly believes that the indicator for those conditions is the total_results value. This is only true for queries that result in less than 201 records.

I have 201 tag objects currently in our Pardot instance. When I query them the first time, I get total_results of 201, telling me how many there are and than a list of 200 records associated with the tagObject key in a list. When I query again, but with an offset of 200 (since the first 200 have offsets 0-199), the total_results value is still 201 (because that is indeed how many records are associated with the query, independent of offset), and now there is only one record returned associated with tagObject and it is not in a list. If I do the same query again, but this time with a very high offset, way past the number of records I can get, I still get a total_results value of 201, but now there is not even a tagObject key in the results. So, I suggest, the fix for this code looks like this:

        # Ensure result['tagObject'] is a list, no matter what.
        result = response.get('result')
        if 'tagObject' not in result:
            result['tagObject'] = []
        elif len(result['tagObject']) == 1:
            result['tagObject'] = [result['tagObject']]

        return result

I have not tested this code, but I believe it will perform the correct actions to normalize the value associated with the tagObject to always be present and be associated with a list. Of course, this would have to be adapted to each of the classes (prospects, tags, ...).

Trying to use output=full for prospects

Hello,
I am using your api wrapper (thank you by the way) and I am trying to make queries for the prospects object with output=full flag as described in the documentation here:
http://developer.pardot.com/kb/api-version-4/prospects/#using-prospects

I am trying to see if there is additional data fields and user activity that might be available.

Additionally, do you happen to know if there is a way to query the forms objects and get the actual form submission data rather than downloading it via back end?

Please advise
Thank you for your time,
MZ

batchupdate is not working

Sample code set:
from pypardot.client import PardotAPI
p = PardotAPI(
email='[email protected]',
password='password',
user_key='userkey'
)

p.authenticate()

p.prospects.batchUpdate(prospects=[{"id":"100", "field":"value"}, {"id":"101", "filed":"value"}])

Error:

pypardot.errors.PardotAPIError: Error #71: Input needs to be valid JSON or XML

Let me know the json format.

Untested Methods

33 of 87 methods remain untested. See Testing wiki page for list of methods as well as documentation as to whether a method is successfully tested, unsuccessfully tested, or untested.

Cannot use output='bulk'

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.

Query a subset of fields from a table

Hey, I am trying to use p.prospects.query(fields=[a_list_of_field_names]) to pull only a subset of fields from the prospects table. However, the method only returns 2 columns no matter how long my list is. The returned columns will always be id and whatever field that is the last element in the list. Am I not passing the parameters correctly? Thank you!

How to send emails

How do I send an email? Does the email account need to be added before hand? I have been looking at this documentation. But cannot figure it out.

users read by email not working correctly

The function read_by_email is not working for the users. I have tested with various different emails that are correct by they all return;

PardotAPIError: Error #11: Invalid user email address

I have connected properly as I am able to access lists and send emails. But just this line of code always fails;

    def get_user_id(self):
        
        print(self.p.users.read_by_email("[email protected]"))

bulk does not work for some API endpoints

dynamicContent,
campaign,
prospectAccount
lifecyclehistories

so far I found output='bulk' does not work for these endpoints. I installed the package using pypi, is github version here ahead of Pypi package?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.