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
7 changes: 5 additions & 2 deletions docs/api/tuf.ngclient.fetcher.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Fetcher
============

.. automodule:: tuf.ngclient.fetcher
.. autoclass:: tuf.ngclient.FetcherInterface
:undoc-members:
:private-members: _fetch
:private-members: _fetch

.. autoclass:: tuf.ngclient.RequestsFetcher
:no-inherited-members:
2 changes: 1 addition & 1 deletion tests/test_fetcher_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from tests import utils
from tuf.api import exceptions
from tuf.ngclient._internal.requests_fetcher import RequestsFetcher
from tuf.ngclient import RequestsFetcher

logger = logging.getLogger(__name__)

Expand Down
6 changes: 6 additions & 0 deletions tuf/ngclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
"""TUF client public API
"""


# requests_fetcher is public but comes from _internal for now (because
# sigstore-python 1.0 still uses the module from there). requests_fetcher
# can be moved out of _internal once sigstore-python 1.0 is not relevant.
Comment thread
jku marked this conversation as resolved.
from tuf.ngclient._internal.requests_fetcher import RequestsFetcher
from tuf.ngclient.config import UpdaterConfig
from tuf.ngclient.fetcher import FetcherInterface
from tuf.ngclient.updater import Updater

__all__ = [
FetcherInterface.__name__,
RequestsFetcher.__name__,
Updater.__name__,
UpdaterConfig.__name__,
]
10 changes: 8 additions & 2 deletions tuf/ngclient/_internal/requests_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
HTTP library.
"""

# requests_fetcher is public but comes from _internal for now (because
# sigstore-python 1.0 still uses the module from there). requests_fetcher
# can be moved out of _internal once sigstore-python 1.0 is not relevant.

import logging
from typing import Dict, Iterator, Tuple
from urllib import parse
Expand All @@ -24,8 +28,10 @@ class RequestsFetcher(FetcherInterface):
"""An implementation of ``FetcherInterface`` based on the requests library.

Attributes:
_sessions: Dictionary of ``Requests.Session`` objects storing a separate
session per scheme+hostname combination.
socket_timeout: Timeout in seconds, used for both initial connection
delay and the maximum delay between bytes received. Default is
4 seconds.
chunk_size: Chunk size in bytes used when downloading.
"""

def __init__(self) -> None:
Expand Down