Skip to content

Commit a7d6a07

Browse files
committed
feat(DEVC-2097): urllib3 upgrade + fix for MAX_RETRY_COUNT
1 parent f77b106 commit a7d6a07

4 files changed

Lines changed: 46 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
## [1.15.2] - 2026-01-14
10+
### Security
11+
- Upgraded internal dependency `urllib3` to version `urllib3 >= 2.6.3, <3.0.0` since `2.5.0` has [these](https://security.snyk.io/package/pip/urllib3/2.5.0) vulnerabilities
12+
### Fixed
13+
- Fixed issue with `MAX_RETRY_COUNT`
14+
15+
916
## [1.15.1] - 2025-10-06
1017
### Fixed
1118
- Logging duplication on CloudWatch side

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "corva-sdk"
77
description = "SDK for building Corva DevCenter Python apps."
88
readme = "README.md"
9-
version = "1.15.1"
9+
version = "1.15.2"
1010
license = { text = "The Unlicense" }
1111
authors = [
1212
{ name = "Jordan Ambra", email = "jordan.ambra@corva.ai" }
@@ -18,7 +18,7 @@ dependencies = [
1818
"pydantic >=1.8.2, <2.0.0",
1919
"redis >=5.2.1, <6.0.0",
2020
"requests >=2.32.3, <3.0.0",
21-
"urllib3==2.5.0"
21+
"urllib3 >= 2.6.3, <3.0.0",
2222
]
2323
classifiers = [
2424
"Development Status :: 5 - Production/Stable",

src/corva/configuration.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,44 @@
11
import datetime
2+
import logging
3+
from typing import Any
24

3-
import pydantic
5+
from pydantic import AnyHttpUrl, BaseSettings, validator
46

7+
logger = logging.getLogger("corva")
8+
9+
DEFAULT_MAX_RETRY_COUNT = 3
10+
11+
def _parse_max_retry_count(value: Any) -> int:
12+
if value is None or value == "":
13+
return DEFAULT_MAX_RETRY_COUNT
14+
15+
try:
16+
if isinstance(value, bool):
17+
raise TypeError
18+
if isinstance(value, int):
19+
return value
20+
if isinstance(value, str):
21+
return int(value.strip())
22+
except (TypeError, ValueError):
23+
pass
24+
25+
logger.warning(
26+
"Invalid MAX_RETRY_COUNT value %r; using default %d.",
27+
value,
28+
DEFAULT_MAX_RETRY_COUNT,
29+
)
30+
return DEFAULT_MAX_RETRY_COUNT
531

632
def parse_truthy(v):
733
if isinstance(v, bool):
834
return v
935
return str(v or "").strip().lower() in {"1", "true", "t", "yes", "y", "on"}
1036

1137

12-
class Settings(pydantic.BaseSettings):
38+
class Settings(BaseSettings):
1339
# api
14-
API_ROOT_URL: pydantic.AnyHttpUrl
15-
DATA_API_ROOT_URL: pydantic.AnyHttpUrl
40+
API_ROOT_URL: AnyHttpUrl
41+
DATA_API_ROOT_URL: AnyHttpUrl
1642

1743
# cache
1844
CACHE_URL: str
@@ -35,14 +61,18 @@ class Settings(pydantic.BaseSettings):
3561
POOL_BLOCK: bool = True # Wait until connection released
3662

3763
# retry
38-
MAX_RETRY_COUNT: int = 3 # If `0` then retries will be disabled
64+
MAX_RETRY_COUNT: int = DEFAULT_MAX_RETRY_COUNT # If `0` then retries will be disabled
3965
BACKOFF_FACTOR: float = 1.0
4066

4167
OTEL_LOG_SENDING_DISABLED: bool = False
4268

43-
_validate_otel_log_sending_disabled = pydantic.validator(
69+
_validate_otel_log_sending_disabled = validator(
4470
"OTEL_LOG_SENDING_DISABLED", pre=True, allow_reuse=True
4571
)(parse_truthy)
4672

73+
@validator("MAX_RETRY_COUNT", pre=True)
74+
def parse_max_retry_count(cls, v: Any) -> int:
75+
return _parse_max_retry_count(v)
76+
4777

4878
SETTINGS = Settings()

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "1.15.1"
1+
VERSION = "1.15.2"

0 commit comments

Comments
 (0)