Skip to content

Commit 8bb9ef8

Browse files
authored
Fix import of removed httpx type (#103)
1 parent e5eeccb commit 8bb9ef8

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ While the project is still on major version 0, breaking changes may be introduce
1212

1313
<!-- changelog follows -->
1414

15-
<!-- ## Unreleased -->
15+
## Unreleased
16+
17+
### Fixed
18+
19+
- Missing import error when using httpx>=0.28.0. ([#102](https://github.com/unioslo/harborapi/issues/102))
1620

1721
## [0.26.1](https://github.com/unioslo/harborapi/tree/harborapi-v0.26.1) - 2024-11-26
1822

harborapi/client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import contextlib
44
import os
5+
import ssl
56
import warnings
67
from http.cookiejar import CookieJar
78
from pathlib import Path
@@ -22,7 +23,6 @@
2223
import httpx
2324
from httpx import Response
2425
from httpx import Timeout
25-
from httpx._types import VerifyTypes
2626
from pydantic import BaseModel
2727
from pydantic import SecretStr
2828
from pydantic import ValidationError
@@ -184,7 +184,7 @@ def __init__(
184184
# HTTPX client options
185185
follow_redirects: bool = True,
186186
timeout: Union[float, Timeout] = 10.0,
187-
verify: VerifyTypes = True,
187+
verify: Union[ssl.SSLContext, str, bool] = True,
188188
# Retry options
189189
retry: Optional[RetrySettings] = RetrySettings(), # type: ignore[call-arg]
190190
**kwargs: Any,
@@ -226,10 +226,10 @@ def __init__(
226226
timeout : Union[float, Timeout]
227227
The timeout to use for requests.
228228
Can be either a float or a `httpx.Timeout` object.
229-
verify : VerifyTypes
229+
verify : Union[ssl.SSLContext, str, bool]
230230
Control verification of the server's TLS certificate.
231-
See `httpx._types.VerifyTypes` for more information or
232-
<https://www.python-httpx.org/advanced/ssl/>.
231+
Can be an SSL context, a path to a CA bundle, or a boolean.
232+
Defaults to True.
233233
**kwargs : Any
234234
Backwards-compatibility with deprecated parameters.
235235
Unknown kwargs are ignored.
@@ -271,7 +271,7 @@ def authenticate(
271271
basicauth: Optional[str] = None,
272272
credentials_file: Optional[Union[str, Path]] = None,
273273
url: Optional[str] = None,
274-
verify: Optional[VerifyTypes] = None,
274+
verify: Optional[Union[ssl.SSLContext, str, bool]] = None,
275275
**kwargs: Any,
276276
) -> None:
277277
"""(Re-)Authenticate the client with the provided credentials.
@@ -291,7 +291,7 @@ def authenticate(
291291
`username`, `secret` and `basicauth` must not be provided if this is used.
292292
url : Optional[str]
293293
The URL of the Harbor server in the format `http://host:[port]/api/v<version>`
294-
verify : Optional[VerifyTypes]
294+
verify : Optional[Union[ssl.SSLContext, str, bool]]
295295
Control verification of the server's TLS certificate.
296296
**kwargs : Any
297297
Additional keyword arguments to pass in.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ classifiers = [
2929
"Typing :: Typed",
3030
]
3131
dependencies = [
32-
"httpx>=0.22.0",
32+
"httpx>=0.28.1",
3333
"pydantic>=2.2.1",
3434
"backoff>=2.1.2",
3535
"typing_extensions>=4.4.0",

0 commit comments

Comments
 (0)