Download gitlab ci jobs artifacts using Python

Hi All,

I’m using the Gitlab Python API to get information from my projects pipelines and jobs. I want to download all the artifacts for the last pipeline of a projects, but I’m getting some issues with the method “job.artifacts”. It returns me an type error “TypeError: ‘list’ object is not callable”

This is what I’m doing:


Does anyone have an idea of why the method " job.artifacts(streamed=True, action=f.write)" is not working?

Thanks a lot in advance!

1 Like

Yeah…I’m a bit late to the party, but perhaps this will help someone. My first job saves the artifacts, so I wrote the following to download and unzip.

if last_pipeline:
     pipeline_job =[0]
     job =, lazy=True)
     file_name = ''
     with open(file_name, "wb") as f:
         job.artifacts(streamed=True, action=f.write)
     zip = zipfile.ZipFile(file_name)

This one definitely helped me! Encountered the exact same error and this answer resolved it. Someone should update the python-gitlab API doc with this answer concerning fetching of artifacts from a job.