mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Fetcher interface should only raise DownloadErrors,
regardless of the implementation.
* Make sure fetch() wraps non-DownloadError errors in a DownloadError
* Make the abstract function private _fetch()
* Try to be more consistent in doscstrings
This now makes the example client more sensible (when server does not
respond):
$ ./client_example.py download qwerty
...
Failed to download target qwerty: Failed to download url http://127.0.0.1:8000/metadata/2.root.json
(here the latter part of the error string comes from DownloadError
raised by FetcherInterface.fetch())
Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
|
||
|---|---|---|
| .. | ||
| 1.root.json | ||
| client_example.py | ||
| README.md | ||
TUF Client Example
TUF Client Example, using python-tuf.
This TUF Client Example implements the following actions:
- Client Infrastructure Initialization
- Download target files from TUF Repository
The example client expects to find a TUF repository running on localhost. We
can use the static metadata files in tests/repository_data/repository
to set one up.
Run the repository using the Python3 built-in HTTP module, and keep this session running.
$ python3 -m http.server -d tests/repository_data/repository
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
How to use the TUF Client Example to download a target file.
$ ./client_example.py download file1.txt