Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending Classes #11

Closed
andrewstautz opened this issue Aug 8, 2018 · 2 comments
Closed

Extending Classes #11

andrewstautz opened this issue Aug 8, 2018 · 2 comments

Comments

@andrewstautz
Copy link

Hi -

I was using the code snippet from guysoft to extend the base client to emails (for which thanks!), and I noticed a couple of things:

  1. One needs to add "**options" to the params dictionary inside the function definition(s) if one wants to pass parameters as arguments to the function. I don't know if I said that right. What I mean is:
def get_email_campaigns(self, **options):
        params = {**options}
  1. I'm not sure how pagination works, really, in the extended classes, but something like this seems to:
def get_email_campaigns(self, **options):
        params = {**options}
        output = []
        finished = False
        while not finished:
            page = self._call("campaigns", method="GET", params=params)
            params['offset'] = page['offset']
            output.extend(page['campaigns'])
            if page['hasMore'] == False:
                finished = True

        return output

Neither of these is issues with the code itself, I don't think, but maybe they'd be useful for the documentation? I'm very much a beginner and I find it helpful to have examples spelled out for me. Thought I'd maybe save someone some time. Because this really is the best python sdk out there for hubspot!

Andrew S.

@jpetrucciani
Copy link
Owner

Thanks for the suggestions! I've definitely not been taking good care of the documentation for this lib.

I've really gotta get readthedocs set up for this and get things moved from the readme into some real documentation.

@jpetrucciani
Copy link
Owner

I've got a base set up on readthedocs now!
https://hubspot3.readthedocs.io/en/latest/

I've added a section on pagination and included an example.

Feel free to fork and add anything you think would be useful! I'll try to slowly add more and more documentation until it's a bit more built out

jpetrucciani pushed a commit that referenced this issue Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants