in buildkite/download-artifact/download_artifacts.py [0:0]
def download_artifacts(artifacts: list) -> None:
"""
Downloads artifacts to the current directory and maintains the folder structure.
:param artifacts: https://buildkite.com/docs/apis/rest-api/artifacts#list-artifacts-for-a-build
"""
for artifact in artifacts:
# https://buildkite.com/docs/apis/rest-api/artifacts#download-an-artifact
download_response = requests.get(
artifact["download_url"],
headers=HEADERS,
allow_redirects=True
)
os.makedirs(artifact["dirname"], exist_ok=True)
with open(artifact["path"], 'wb') as f:
f.write(download_response.content)