- I cannot edit the merge request / issue I’ve just retrieved
It is likely that you used a
GroupIssueobject. These objects cannot be edited. But you can create a new
ProjectIssueobject to apply changes. For example:
issue = gl.issues.list() project = gl.projects.get(issue.project_id, lazy=True) editable_issue = project.issues.get(issue.iid, lazy=True) # you can now edit the object
- I get an
AttributeErrorwhen accessing attributes of an object retrieved via a
Fetching a list of objects, doesn’t always include all attributes in the objects. To retrieve an object with all attributes use a
Example with projects:
for projects in gl.projects.list(): # Retrieve project object with all attributes project = gl.projects.get(project.id)
- How can I clone the repository of a project?
python-gitlab doesn’t provide an API to clone a project. You have to use a git library or call the
The git URI is exposed in the
import subprocess project = gl.projects.create(data) # or gl.projects.get(project_id) print(project.attributes) # displays all the attributes git_url = project.ssh_url_to_repo subprocess.call(['git', 'clone', git_url])
- I get an
AttributeErrorwhen accessing attributes after
You are most likely trying to access an attribute that was not returned by the server on the second request. Please look at the documentation in Attributes in updated objects to see how to avoid this.
- I passed
--allvia the CLI) to the API and I still cannot see all items returned.
--get-allvia the CLI). See Pagination for more details.