Skip to content

RFE: support for release asset download #2375

Open

Description

@nickbroon

Description of the problem, including code/CLI snippet

Bindings for the /projects/:id/releases/:tag_name/downloads/:filepath endpoint would be very useful

https://docs.gitlab.com/ee/api/releases/#download-a-release-asset

Specifications

  • python-gitlab version: 3.11
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): gitlab.com

Activity

  1. nejch commented on Nov 12, 2022

    @nejch
    Member

    Note to self: it's a kind of a funky API, with more related endpoints:

    GET /projects/:id/releases/:tag_name/downloads/:filepath
    GET /projects/:id/releases/permalink/latest/downloads/:filepath
    # see also
    GET /projects/:id/releases/permalink/latest
    GET /projects/:id/releases/permalink/latest/evidence
    
  2. paisleyrob commented on Jan 9, 2023

    @paisleyrob

    I'd also like this to be added. In the mean time, I'm using the API as follows to download all release asset links. Assume namespace has project_id and tag set accordingly.

    try:
        project = gl.projects.get(namespace.project_id)
        release = project.releases.get(namespace.tag)
        for asset in release.assets['links']:
            with open(asset['name'], "wb") as f:
                response =  gl.http_get(path=asset['url'])
                for chunk in response.iter_content(chunk_size=4096):
                    f.write(chunk)
    except gitlab.exceptions.GitlabGetError as e:
        print(e.error_message)
  3. nickbroon commented on Jun 12, 2023

    @nickbroon
    ContributorAuthor

    I wonder if this can share any code with, or at least be implemented in a similar way to the GenericPackageManager.download() method?

    And as mentioned by @nejch the :tag_name argument handling might need a special case for permalink/latest

  4. ColinSeibel commented on Jun 23, 2023

    @ColinSeibel

    I just had a look at this feature. So far, it looks like there's only one other endpoint with similar behavior:

    GET /projects/:id/pipelines/latest
    GET /projects/:id/releases/permalink/latest
    

    So I'm not sure if it makes sense to implement this in a generic way. What do you think of the following suggestion, without looking deep into the code base:

    Extend releases.py with new class:

    class ProjectReleaseLatest(CRUDMixin, RESTManager):
        _path = "/projects/{project_id}/releases/permalink/latest"
        _obj_cls = ProjectRelease
        _from_parent_attrs = {"project_id": "id"}
        _create_attrs = RequiredOptional(
            required=("tag_name",), optional=("name", "description", "ref", "assets")
        )

    Add this to Project class in projects.py:

    class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTObject):
        _repr_attr = "path_with_namespace"
    
        releases: ProjectReleaseManager
        release_latest: ProjectReleaseLatest

    Usage:

    project = git.projects.get(project_id, lazy=True)
    release = project.release_latest

    If you think it's ok, I can test the change and prepare a PR.

  5. nickbroon commented on Aug 9, 2024

    @nickbroon
    ContributorAuthor

    @ColinSeibel, did you ever get round to looking at adding the support for release asset download?

  6. ColinSeibel commented on Aug 9, 2024

    @ColinSeibel

    Hi @nickbroon, I did not look into more details so far. As my main focus was on getting the latest release, I just use following workaround in combination with downloading the assets manually, slightly similar to @paisleyrob's snippet.

    project = git.projects.get(project_id, lazy=True)
    releases = project.releases.list(order_by='released_at', sort='desc')
    if releases:
        latest_release = releases[0]
  7. github-actions commented on Jul 9, 2025

    @github-actions

    This issue was marked stale because it has been open 60 days with
    no activity. Please remove the stale label or comment on this
    issue. Otherwise, it will be closed in 15 days.

    As an open-source project, we rely on community contributions to
    address many of the reported issues. Without a proposed fix or
    active work towards a solution it is our policy to close inactive
    issues. This is documented in CONTRIBUTING.rst

    How to keep this issue open:

    • If you are still experiencing this issue and are willing to
      investigate a fix, please comment and let us know.
    • If you (or someone else) can propose a pull request with a
      solution, that would be fantastic.
    • Any significant update or active discussion indicating progress
      will also prevent closure.

    We value your input. If you can help provide a fix, we'd be happy
    to keep this issue open and support your efforts.

    This is documented in CONTRIBUTING.rst
    https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst

  8. nickbroon commented on Jul 9, 2025

    @nickbroon
    ContributorAuthor

    Support for the /projects/:id/releases/:tag_name/downloads/:filepath endpoint would still be useful.

  9. github-actions commented on Sep 9, 2025

    @github-actions

    This issue was marked stale because it has been open 60 days with
    no activity. Please remove the stale label or comment on this
    issue. Otherwise, it will be closed in 15 days.

    As an open-source project, we rely on community contributions to
    address many of the reported issues. Without a proposed fix or
    active work towards a solution it is our policy to close inactive
    issues. This is documented in CONTRIBUTING.rst

    How to keep this issue open:

    • If you are still experiencing this issue and are willing to
      investigate a fix, please comment and let us know.
    • If you (or someone else) can propose a pull request with a
      solution, that would be fantastic.
    • Any significant update or active discussion indicating progress
      will also prevent closure.

    We value your input. If you can help provide a fix, we'd be happy
    to keep this issue open and support your efforts.

    This is documented in CONTRIBUTING.rst
    https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst

  10. github-actions commented on Sep 25, 2025

    @github-actions

    This issue was closed because it has been marked stale for 15 days
    with no activity.

    This open-source project relies on community contributions, and
    while we value all feedback, we have a limited capacity to address
    every issue without a clear path forward.

    Currently, this issue hasn't received a proposed fix, and there
    hasn't been recent active discussion indicating someone is planning
    to work on it. To maintain a manageable backlog and focus our
    efforts, we will be closing this issue for now.

    This doesn't mean the issue isn't valid or important. If you or
    anyone else in the community is willing to investigate and propose
    a solution (e.g., by submitting a pull request), please do.

    We believe that those who feel a bug is important enough to fix
    should ideally be part of the solution. Your contributions are
    highly welcome.

    Thank you for your understanding and potential future
    contributions.

    This is documented in CONTRIBUTING.rst
    https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst

  11. reopened this on Sep 25, 2025
  12. github-actions commented on Nov 25, 2025

    @github-actions

    This issue was marked stale because it has been open 60 days with
    no activity. Please remove the stale label or comment on this
    issue. Otherwise, it will be closed in 15 days.

    As an open-source project, we rely on community contributions to
    address many of the reported issues. Without a proposed fix or
    active work towards a solution it is our policy to close inactive
    issues. This is documented in CONTRIBUTING.rst

    How to keep this issue open:

    • If you are still experiencing this issue and are willing to
      investigate a fix, please comment and let us know.
    • If you (or someone else) can propose a pull request with a
      solution, that would be fantastic.
    • Any significant update or active discussion indicating progress
      will also prevent closure.

    We value your input. If you can help provide a fix, we'd be happy
    to keep this issue open and support your efforts.

    This is documented in CONTRIBUTING.rst
    https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst

  13. github-actions commented on Dec 10, 2025

    @github-actions

    This issue was closed because it has been marked stale for 15 days
    with no activity.

    This open-source project relies on community contributions, and
    while we value all feedback, we have a limited capacity to address
    every issue without a clear path forward.

    Currently, this issue hasn't received a proposed fix, and there
    hasn't been recent active discussion indicating someone is planning
    to work on it. To maintain a manageable backlog and focus our
    efforts, we will be closing this issue for now.

    This doesn't mean the issue isn't valid or important. If you or
    anyone else in the community is willing to investigate and propose
    a solution (e.g., by submitting a pull request), please do.

    We believe that those who feel a bug is important enough to fix
    should ideally be part of the solution. Your contributions are
    highly welcome.

    Thank you for your understanding and potential future
    contributions.

    This is documented in CONTRIBUTING.rst
    https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst

  14. reopened this on Dec 10, 2025
  15. self-assigned this
    on Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions