Skip to content

Commit f8a7881

Browse files
committed
Make RequestsFetcher public
This is useful for those who want to use the default fetcher but modify some attributes The file itself could be moved to tuf/ngclient/ but this is not done yet as sigstore-python is using this internal module. Move can be done once sigstore-python 1.0 is no longer relevant. Fixes #2268 Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent d2908c0 commit f8a7881

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

tests/test_fetcher_ng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from tests import utils
2222
from tuf.api import exceptions
23-
from tuf.ngclient._internal.requests_fetcher import RequestsFetcher
23+
from tuf.ngclient import RequestsFetcher
2424

2525
logger = logging.getLogger(__name__)
2626

tuf/ngclient/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@
44
"""TUF client public API
55
"""
66

7+
8+
# requests_fetcher is public but comes from _internal for now (because
9+
# sigstore-python 1.0 still uses the module from there). requests_fetcher
10+
# can be moved out of _internal once sigstore-python 1.0 is not relevant.
11+
from tuf.ngclient._internal.requests_fetcher import RequestsFetcher
712
from tuf.ngclient.config import UpdaterConfig
813
from tuf.ngclient.fetcher import FetcherInterface
914
from tuf.ngclient.updater import Updater
1015

1116
__all__ = [
1217
FetcherInterface.__name__,
18+
RequestsFetcher.__name__,
1319
Updater.__name__,
1420
UpdaterConfig.__name__,
1521
]

tuf/ngclient/_internal/requests_fetcher.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ class RequestsFetcher(FetcherInterface):
2424
"""An implementation of ``FetcherInterface`` based on the requests library.
2525
2626
Attributes:
27-
_sessions: Dictionary of ``Requests.Session`` objects storing a separate
28-
session per scheme+hostname combination.
27+
socket_timeout: Timeout in seconds, used for both initial connection
28+
delay and the maximum delay between bytes received. Default is
29+
4 seconds.
30+
chunk_size: Chunk size in bytes used when downloading.
2931
"""
3032

3133
def __init__(self) -> None:

0 commit comments

Comments
 (0)