@@ -71,21 +71,9 @@ def get_taskcluster_client(service: str):
7171
7272
7373def _handle_artifact (
74- path : str , response : Union [requests .Response , dict [str , Any ]]
74+ path : str ,
75+ response : requests .Response ,
7576) -> Any :
76- # When taskcluster client returns non-JSON responses, it wraps them in {"response": <Response>}
77- if (
78- isinstance (response , dict )
79- and "response" in response
80- and isinstance (response ["response" ], requests .Response )
81- ):
82- response = response ["response" ]
83-
84- if not isinstance (response , requests .Response ):
85- # At this point, if we don't have a response object, it's already parsed, return it
86- return response
87-
88- # We have a response object, load the content based on the path extension.
8977 if path .endswith (".json" ):
9078 return response .json ()
9179
@@ -159,6 +147,7 @@ def get_artifact(task_id, path):
159147 """
160148 queue = get_taskcluster_client ("queue" )
161149 response = queue .getLatestArtifact (task_id , path )
150+ response = get_session ().get (response ["url" ])
162151 return _handle_artifact (path , response )
163152
164153
@@ -231,6 +220,8 @@ def pagination_handler(response):
231220def get_artifact_from_index (index_path , artifact_path ):
232221 index = get_taskcluster_client ("index" )
233222 response = index .findArtifactFromTask (index_path , artifact_path )
223+ assert 300 <= response ["response" ].status_code < 400
224+ response = get_session ().get (response ["response" ].headers ["location" ])
234225 return _handle_artifact (artifact_path , response )
235226
236227
0 commit comments