Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [9.1.0] - 2025-09-15
### Added
- Added support for a configurable timeout and retry spec, and raw response return for `JsonEndpoint`

## [9.0.0] - 2025-08-19
### Removed
- apiron no longer supports Python 3.9, which reaches end of life on 2025-10-31
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "apiron"
version = "9.0.0"
version = "9.1.0"
Comment thread
eslawski marked this conversation as resolved.
description = "apiron helps you cook a tasty client for RESTful APIs. Just don't wash it with SOAP."
authors = [
{ name = "Ithaka Harbors, Inc.", email = "opensource@ithaka.org" },
Expand Down
9 changes: 9 additions & 0 deletions src/apiron/endpoint/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
from collections.abc import Iterable
from typing import Any

from urllib3.util import retry

from apiron import Timeout
from apiron.endpoint.endpoint import Endpoint


Expand All @@ -18,12 +21,18 @@ def __init__(
default_params: dict[str, Any] | None = None,
required_params: Iterable[str] | None = None,
preserve_order: bool = False,
return_raw_response_object: bool = False,
timeout_spec: Timeout | None = None,
retry_spec: retry.Retry | None = None,
):
super().__init__(
path=path,
default_method=default_method,
default_params=default_params,
required_params=required_params,
return_raw_response_object=return_raw_response_object,
timeout_spec=timeout_spec,
retry_spec=retry_spec,
)
self.preserve_order = preserve_order

Expand Down
14 changes: 14 additions & 0 deletions tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from unittest import mock

import pytest
from urllib3.util import retry

import apiron

Expand Down Expand Up @@ -149,6 +150,19 @@ def test_repr_method(self):
foo = apiron.JsonEndpoint(path="/bar/baz")
assert repr(foo) == "JsonEndpoint(path='/bar/baz')"

def test_timeout_spec_parameter(self):
timeout_spec = apiron.Timeout(connection_timeout=5, read_timeout=10)
foo = apiron.JsonEndpoint(timeout_spec=timeout_spec)
assert foo.timeout_spec == timeout_spec

def test_retry_spec_parameter(self):
retry_spec = retry.Retry(total=3, backoff_factor=1)
foo = apiron.JsonEndpoint(retry_spec=retry_spec)
assert foo.retry_spec == retry_spec

def test_return_raw_response_object_parameter(self):
foo = apiron.JsonEndpoint(return_raw_response_object=True)
assert foo.return_raw_response_object is True

class TestStreamingEndpoint:
def test_format_response(self):
Expand Down