Utilities

exception pypipedrive.utils.BetaWarning[source]

Indicates a Pipedrive API endpoint that is still in beta.

pypipedrive.utils.build_multipart_file_tuple(data: bytes = None, file_name: str = None, content_type: str = None) Tuple[str, bytes, str][source]

Build the multipart/form-data file tuple for uploading.

Args:

data: The binary data to upload. file_name: The name of the file. content_type: The MIME type of the file.

Returns:

A dictionary suitable for the files parameter in requests.

pypipedrive.utils.date_from_iso_str(value: str | date | None) date | None[source]

Convert ISO 8601 date string into a date object.

Args:

value: date string, e.g. “2014-09-05”

pypipedrive.utils.date_to_iso_str(value: date | datetime | None) str | None[source]

Convert a date or datetime into a ISO 8601 string

Args:

value: date or datetime object, e.g. “2014-09-05”

pypipedrive.utils.datetime_from_iso_str(value: str | None) datetime | None[source]

Convert an ISO 8601 datetime string into a datetime object.

Args:

value: datetime string, e.g. “2014-09-05T07:00:00.000Z”

pypipedrive.utils.datetime_to_iso_str(value: datetime | None) str | None[source]

Convert datetime object into a ISO 8601 string e.g. “2014-09-05T12:34:56.000Z”

Args:

value: datetime object

pypipedrive.utils.duration_from_hh_ss_str(value: str | None) timedelta | None[source]

Convert an ISO 8601 time string HH:SS into a duration object.

Args:

value: time string, e.g. “00:15” (15 minutes)

pypipedrive.utils.duration_to_hh_ss_str(value: timedelta | None) str | None[source]

Convert an ISO 8601 time object into a duration string HH:SS.

Args:

value: time string, e.g. “00:15” (15 minutes)

pypipedrive.utils.time_from_iso_str(value: str | None) time | None[source]

Convert an ISO 8601 time string into a time object.

Args:

value: time string, e.g. “12:34”

pypipedrive.utils.time_to_iso_str(value: time | None) str | None[source]

Convert an ISO 8601 time object into a time string.

Args:

value: time string, e.g. “12:34”

pypipedrive.utils.warn_endpoint_beta(func)[source]

Decorator to warn about usage of a BETA endpoint (v2).

pypipedrive.utils.warn_endpoint_legacy(func, *args, **kwargs)[source]

Decorator to warn about usage of legacy endpoints (v1) within migrated v2 entities.