Skip to content

DuploAPI

The HTTP client for interacting with the Duplo API. Handles authentication, request caching, and response validation.

Duplo API Client

HTTP client for the Duplo API. Handles authentication, request caching, and response validation.

Properties

token: str property

HTTP Methods

The following methods are used to make requests to the Duplo API. They are simply the standard HTTP methods scoped to the configured host and token.

get

Get a Duplo resource.

This request is cached for 60 seconds.

Parameters:

Name Type Description Default
path str

The path to the resource.

required

Returns: The resource as a JSON object.

post

Post data to a Duplo resource.

Parameters:

Name Type Description Default
path str

The path to the resource.

required
data dict

The data to post.

{}
headers dict

Optional headers merged over the default auth headers (e.g. {"Accept": "text/event-stream"}).

None
kwargs

Extra arguments forwarded to the underlying request, such as stream=True for SSE / chunked responses. When streaming, the response is returned unbuffered so callers can iterate iter_lines() / iter_content(); use a with block so the connection closes cleanly.

{}

Returns: The response as a JSON object, or a streaming response when stream=True is passed.

put

Put data to a Duplo resource.

Parameters:

Name Type Description Default
path str

The path to the resource.

required
data dict

The data to post.

{}

Returns: The response as a JSON object.

delete

Delete a Duplo resource.

Parameters:

Name Type Description Default
path str

The path to the resource.

required

Returns: The response as a JSON object.