[Python] GitLab to get all repo names using RESTAPI [closed]

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    Here is a simple python script to get all available repo names in BitBucket using restapi. This uses existing packages in python

    #!/usr/bin/python3
    import requests
    import getpass

    username = input('Username? ')
    password = getpass.getpass('Password? ')
    server_addr = input('Server name? ')
    groupid = input('Group id? ')

    restapi_loc = f"https://{server_addr}/rest/api/1.0/projects/{groupid}/repos"
    result = requests.get(f"{restapi_loc}?start=0&limit=1000", auth=(username,password), headers={"Content-Type": "application/json"}, verify=False)
    print("---START---")
    for val in result.json().get('values', []):
    print(val['slug'])
    print("---END---")


    Now we are moving to GiLab. So i need a simple script like above for GitLab. Is GitLab supports such query over restapi? if so how to do it?

    I am need to do it without installing python wrappers or any special packages. The basic I need to know is the authentication and the basic request

    Continue reading...

Compartilhe esta Página