Created
November 18, 2019 08:40
-
-
Save Wingless-Archangel/78f26afbaaba07ff503b91888e9f14dd to your computer and use it in GitHub Desktop.
Retreive repository in Gitlab via API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
URL = 'https://gitlab.com/api/v4/projects' | |
API_KEY = '' | |
payload = {'private_token' : API_KEY,'simple' : True} | |
def main(): | |
''' make the connection to local gitlab ''' | |
conn = requests.get(URL,params=payload) | |
dict_result = json.loads(conn.text) | |
for ele in dict_result: | |
repo = ele['path_with_namespace'].split("/") | |
print("Team name: " + repo[0] + "\t" + "Repo name:" + repo[1]) | |
if __name__ == "__main__": | |
main()% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment