Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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
"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]
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]
# 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]
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