I am using python-gitlab which is a python wrapper for the original Gitlab API. I am actually using it to create scripts to access and modify gitlab projects. I came across a constraint while working with it, which is to mention the project id as the parameter when searching for a project which beats the purpose of using it because then I have to check the project id again and again to query through the projects for which I need to open up gitlab on my browser.
So I created a work around for it by querying the list of projects under a user and then searching for the repo name from the list and then accessing the id to alter stuff:
projects = gl.projects.list()
for project in projects:
#here "test" is the name of a dummy project that I am trying to query
if project.name == "test":
project_id = project.id
print(project_id)
p = gl.projects.get(project_id)
print(p)
So, I just wanted to know if there was an inbuilt method in the package itself which may take in the name of the project directly or this is the only way possible for what I am trying to achieve.
This thing can be done using the following code using the same projects.get() method but requires both the user name and the project name:
p = gl.projects.get('user_name/project_name')