How to use the hubspot3.utils.prettify function in hubspot3

To help you get started, we’ve selected a few hubspot3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jpetrucciani / hubspot3 / hubspot3 / companies.py View on Github external
output = []

        while not finished:
            params = {"count": limit, "offset": offset}
            if since:
                params["since"] = since
            batch = self._call(
                "companies/recent/{}".format(recency_type),
                method="GET",
                doseq=True,
                params=params,
                **options
            )
            output.extend(
                [
                    prettify(company, id_key="companyId")
                    for company in batch["results"]
                    if not company["isDeleted"]
                ]
            )
            finished = not batch["hasMore"]
            offset = batch["offset"]

        return output
github jpetrucciani / hubspot3 / hubspot3 / products.py View on Github external
batch = self._call(
                "objects/products/paged",
                method="GET",
                params=ordered_dict(
                    {
                        "limit": querylimit,
                        "offset": offset,
                        "properties": ["name", "description", *properties],
                    }
                ),
                doseq=True,
                **options
            )
            output.extend(
                [
                    prettify(obj, id_key="objectId")
                    for obj in batch["objects"]
                    if not obj["isDeleted"]
                ]
            )
            finished = not batch["hasMore"]
            offset = batch["offset"]

        return output
github jpetrucciani / hubspot3 / hubspot3 / deals.py View on Github external
"count": query_limit,
                "offset": offset,
                "includePropertyVersions": include_versions,
            }
            if since:
                params["since"] = since
            batch = self._call(
                "deal/recent/{}".format(recency_type),
                method="GET",
                params=params,
                doseq=True,
                **options
            )
            output.extend(
                [
                    prettify(deal, id_key="dealId")
                    for deal in batch["results"]
                    if not deal["isDeleted"]
                ]
            )
            finished = not batch["hasMore"] or len(output) >= limit
            offset = batch["offset"]

        return output[:limit]
github jpetrucciani / hubspot3 / hubspot3 / deals.py View on Github external
while not finished:
            batch = self._call(
                "deal/paged",
                method="GET",
                params={
                    "limit": query_limit,
                    "offset": offset,
                    "properties": properties,
                    "includeAssociations": True,
                },
                doseq=True,
                **options
            )
            output.extend(
                [
                    prettify(deal, id_key="dealId")
                    for deal in batch["deals"]
                    if not deal["isDeleted"]
                ]
            )
            finished = not batch["hasMore"] or (limited and len(output) >= limit)
            offset = batch["offset"]

        return output if not limited else output[:limit]
github jpetrucciani / hubspot3 / hubspot3 / contacts.py View on Github external
# append extras if they exist
        if extra_properties:
            if isinstance(extra_properties, list):
                properties.update(extra_properties)
            if isinstance(extra_properties, str):
                properties.add(extra_properties)

        batch = self._call(
            "contact/vids/batch",
            method="GET",
            doseq=True,
            params={"vid": ids, "property": list(properties)},
        )
        # It returns a dict with IDs as keys
        return [prettify(batch[contact], id_key="vid") for contact in batch]
github jpetrucciani / hubspot3 / hubspot3 / companies.py View on Github external
while not finished:
            batch = self._call(
                "companies/paged",
                method="GET",
                doseq=True,
                params={
                    "limit": query_limit,
                    "offset": offset,
                    "propertiesWithHistory": properties,
                    "includeMergeAudits": "true",
                },
                **options
            )
            output.extend(
                [
                    prettify(company, id_key="companyId")
                    if prettify_output
                    else company
                    for company in batch["companies"]
                    if not company["isDeleted"]
                ]
            )
            finished = not batch["has-more"]
            offset = batch["offset"]

        return output