0

I am using python-gitlab to access my Gitlab repo's data and get a list of all my repo's issues by running the following:

project = gl.projects.get(#my_project_id)
issues = project.issues.list()

I can then print this list to see which issues are in the list.

issues
[<ProjectIssue iid:1>,<ProjectIssue iid:2>...]

I have also tried to get the info for a specific issue by running:

issue = project.issues.get(1)     #example for issue 1

However, I don't know how to access all the info within that particular issue

When trying to run the "issue" line, I get the following, but I cannot see all the attributes and information of that issue. I'm looking for all the information that should be sent in the API response as defined here (eg. state, author, description, etc). How can I see this information?

issue
<ProjectIssue iid:1>

I know that python-gitlab has defined some methods like the .time_stats() to list the time stats for my issue, but I can't find which method to use to find ALL the information for that issue

[In] issue.time_stats()
[Out] {'time_estimate': 0, 'total_time_spent': 0, 'human_time_estimate': None, 'human_total_time_spent': None}
1
  • Try to call dir(issue) Docs says that this should be possible: issue.attributes['time_stats'] Commented Mar 22, 2021 at 23:16

1 Answer 1

1

When you run project.issues.get(1) it's returning the GitLab Issue as an object (the ProjectIssue class), not as json or an array. I'm not familiar with python-gitlab (and haven't used python in years) but the issue data is likely accessible as an attribute:

issue = project.issues.get(1)
description = issue.description
labels = issue.labels

Note that some of the attributes of the ProjectIssue class might be another object.

To get all attributes on the ProjectIssue class, you can do

issue = project.issues.get(1)
getmembers(issue)

See this answer for more details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.