File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,11 @@ def raise_response(response: httpx.Response) -> None:
28
28
29
29
30
30
if __name__ == "__main__" :
31
+ client = httpx .Client (
32
+ follow_redirects = True ,
33
+ timeout = 3 * 60 ,
34
+ )
35
+
31
36
owner , repo = parse .urlparse (os .getenv ("REPOSITORY_URL" )).path .lstrip ("/" ).split ("/" )[0 :2 ]
32
37
33
38
download_url = "/" .join ([
@@ -40,19 +45,19 @@ def raise_response(response: httpx.Response) -> None:
40
45
os .getenv ("ARTIFACT_NAME" ),
41
46
])
42
47
print (f"Fetching download URL from { download_url } " )
43
- response = httpx .get (download_url , follow_redirects = True )
48
+ response = client .get (download_url )
44
49
raise_response (response )
45
50
46
51
# The workflow is still pending, retry in a bit
47
52
while response .status_code == 202 :
48
53
print (f"{ response .json ()['error' ]} . Retrying in 10 seconds." )
49
54
time .sleep (10 )
50
- response = httpx .get (download_url , follow_redirects = True )
55
+ response = client .get (download_url )
51
56
52
57
raise_response (response )
53
58
url = response .json ()["url" ]
54
59
print (f"Downloading build from { url } " )
55
- zipped_content = httpx .get (url , follow_redirects = True , timeout = 3 * 60 )
60
+ zipped_content = client .get (url )
56
61
zipped_content .raise_for_status ()
57
62
58
63
zip_file = Path ("temp.zip" )
You can’t perform that action at this time.
0 commit comments