API client¶
- class pypipedrive.api.api.Api(api_token: str = None, version='v2')[source]¶
Pipedrive API client for https://pipedrive.readme.io/docs/ documentation.
Supports the Piperive API V1 and V2 versions. By default, the
Apiinstance is initialized with the V2 version. When the Model doesn’t support it, it fallbacks to the V1 version. However, it is possible to force the usage of V1 version:>>> from pypipedrive.api import Api, V1 >>> Api(version=V1)
- all(uri: str, params: Dict[str, Any] | None = None) ApiResponse[source]¶
Make a GET request to retrieve all items from a paginated endpoint.
- Args:
uri: Endpoint URI to call. params: Initial query parameters (copied internally).
- Returns:
A list of all items retrieved from the paginated endpoint.
- property api_token: str¶
Pipedrive API token used in all calls.
- batch_delete(uri: str = None, ids: List[str | int] = []) ApiResponse[source]¶
Make a batch DELETE request to the Pipedrive API using ids.
- Args:
uri: API endpoint ids: List of IDs to delete.
- Returns:
The API response.
- build_url(uri: str) str[source]¶
Build the full URL for the given endpoint parts.
- Args:
uri: The endpoint URI.
- Returns:
Full URL
- iterator(uri: str = None, params: Dict[str, Any] | None = None) Iterator[ApiResponse][source]¶
Yield API responses for a paginated endpoint.
- Args:
uri: Endpoint URI to call. params: Initial query parameters (copied internally).
- Yields:
Each requests.Response returned by the API until pagination ends.
- process_response(response: Response) ApiResponse[source]¶
Process the HTTP response from the Pipedrive API.
- Args:
response: The HTTP response object.
- Returns:
The processed response data.
- Raises:
Appropriate exceptions based on the response status code.
- request(method: str, uri: str, headers: Dict[str, Any] | None = None, params: Dict[str, Any] | None = None, json: Dict[str, Any] | None = None, data: Dict[str, Any] | None = None, files: Dict[str, Any] | None = None) ApiResponse[source]¶
Make a request to the Pipedrive API.
- Args:
method: HTTP method to use. uri: The URI we’re attempting to call. params: Additional query params to append to the URL as-is. json: The JSON payload for a POST/PUT/PATCH/DELETE request. files: Files to upload.