File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import traceback
12
12
from hashlib import sha256
13
13
from pathlib import Path
14
14
15
- import requests
15
+ import urllib3
16
16
17
17
from tuf .api .exceptions import DownloadError , RepositoryError
18
18
from tuf .ngclient import Updater
@@ -41,13 +41,17 @@ def init_tofu(base_url: str) -> bool:
41
41
if not os .path .isdir (metadata_dir ):
42
42
os .makedirs (metadata_dir )
43
43
44
- data = requests .get (f"{ base_url } /metadata/1.root.json" ).content
44
+ response = urllib3 .request ("GET" , f"{ base_url } /metadata/1.root.json" )
45
+ if response .status != 200 :
46
+ print (f"Failed to download initial root { base_url } /metadata/1.root.json" )
47
+ return False
48
+
45
49
Updater (
46
50
metadata_dir = metadata_dir ,
47
51
metadata_base_url = f"{ base_url } /metadata/" ,
48
52
target_base_url = f"{ base_url } /targets/" ,
49
53
target_dir = DOWNLOAD_DIR ,
50
- bootstrap = data ,
54
+ bootstrap = response . data ,
51
55
)
52
56
53
57
print (f"Trust-on-First-Use: Initialized new root in { metadata_dir } " )
You can’t perform that action at this time.
0 commit comments