The API call you're using expects a SHA hash not a named identifier. This is how to get information for a named tag as you probably want:

from github import Github

g = Github('thar_be_dragons_here')
repo = g.get_repo('telefonicaid/fiware-orion')
tag = next((x for x in repo.get_tags() if x.name == '3.8.0'))

print(tag)

Which gives:

Tag(name="3.8.0", commit=Commit(sha="18d3634afeb366c62af90b9219c5ffac8e894cad"))

From there you can use the commit object or the SHA it contains to poke around further. You'll also need the token because GitHub needs to know the permissions scope of what your code should be doing (repo scope in this case).

Answer from Chris White on Stack Overflow
Discussions

git - How to get_projects() from github repo using PyGithub? - Stack Overflow
I'm trying to fetch projects from a github repo using PyGithub 1.58.1. More on stackoverflow.com
๐ŸŒ stackoverflow.com
cannot import module Auth form Github by PyGitHub - Stack Overflow
I want to try PyGitHub a Python library to access the GitHub REST API. python imterpreter: anaconda python 3.10 the first step, I install the command pip install PyGithub after that, I try to follo... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Python PyGithub how to list projectCard? - Stack Overflow
I'm trying to access project card from github api with PyGithub but I'm unable to find how to call the projectcard method (https://developer.github.com/v3/projects/cards/) It seems to be ready to u... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - trying to access Github issue comments using PyGithub library - Stack Overflow
I am trying to access issue comments using PyGithub library. this is the function which I implemented, def get_issue_comments_dict(self, repository): """ get issue comments ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 75986987 โ€บ how-to-get-projects-from-github-repo-using-pygithub
git - How to get_projects() from github repo using PyGithub? - Stack Overflow
I'm trying to fetch projects from a github repo using PyGithub 1.58.1. I created those projects manually in browser and I can see them. But when I see repo.get_projects().totalCount, it's giving 0...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ tags โ€บ pygithub โ€บ info
'pygithub' tag wiki - Stack Overflow
PyGitHub is a Python library implementing the GitHub API v3, to manage GitHub resources (repositories, user profiles, organizations, etc.) from Python scripts.
Find elsewhere
๐ŸŒ
PyPI
pypi.org โ€บ project โ€บ PyGithub
PyGithub ยท PyPI
PyGitHub is a Python library to access the GitHub REST API.
      ยป pip install PyGithub
    
Published ย  Mar 22, 2026
Version ย  2.9.0
๐ŸŒ
Readthedocs
pygithub.readthedocs.io โ€บ en โ€บ stable โ€บ github_objects โ€บ Repository.html
Repository โ€” PyGithub 0.1.dev50+gecd47649e documentation
This class represents Repositories ยท The reference can be found here https://docs.github.com/en/rest/reference/repos
๐ŸŒ
GitHub
github.com โ€บ PyGithub
PyGithub ยท GitHub
PyGithub has one repository available. Follow their code on GitHub.
๐ŸŒ
Anaconda.org
anaconda.org โ€บ conda-forge โ€บ pygithub
pygithub - conda-forge
Organization created on Apr 11, 2015 ยท A community-led collection of recipes, build infrastructure, and distributions for the conda package manager
๐ŸŒ
GitHub
github.com โ€บ PyGithub โ€บ PyGithub
GitHub - PyGithub/PyGithub: Typed interactions with the GitHub API v3 ยท GitHub
PyGitHub is a Python library to access the GitHub REST API.
Starred by 7.7K users
Forked by 1.9K users
Languages ย  Python 99.6% | Shell 0.4%
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 63851215 โ€บ python-pygithub-how-to-list-projectcard
Python PyGithub how to list projectCard? - Stack Overflow
I'm trying to access project card from github api with PyGithub but I'm unable to find how to call the projectcard method (https://developer.github.com/v3/projects/cards/) It seems to be ready to u...
Top answer
1 of 2
2

Okay, first of all, a Minimal Reproducible Example for your question is:

import github

gh = github.Github()
repo = gh.get_repo('PyGithub/PyGithub')
for issue in repo.get_issues():
    comments = issue.get_issue_comments()

which results in:

AttributeError: 'Issue' object has no attribute 'get_issue_comments'

How to solve this?

Python is literally telling you that the Issue object does not have a method (or any attribute, for that matter) called get_issue_comments. Apparently you're calling the wrong method.

So how can you know which methods are available? I agree the documentation is (at the time of writing) quite limited. You have a number of other options:

Using help()

For any Python object (module, class, method, ...) that has a proper docstring, the built-in help() function is really very helpful ;-)

issue = repo.get_issues()[0]
help(issue)

This will print:

Help on Issue in module github.Issue object:

class Issue(github.GithubObject.CompletableGithubObject)
 |  Issue(requester, headers, attributes, completed)
 |
 |  This class represents Issues. The reference can be found here https://developer.github.com/v3/issues/
 |
 |  Method resolution order:
 |      Issue
 |      github.GithubObject.CompletableGithubObject
 |      github.GithubObject.GithubObject
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __repr__(self)
 |      Return repr(self).
 |
...
 |
 |  get_comments(self, since=NotSet)
 |      :calls: `GET /repos/:owner/:repo/issues/:number/comments <http://developer.github.com/v3/issues/comments>`_
 |      :param since: datetime.datetime format YYYY-MM-DDTHH:MM:SSZ
 |      :rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.IssueComment.IssueComment`
 |
...

As you can see, the class is well documented and apparently it contains a method 'get_comments', which you can use.

Using dir()

You can also see which attributes (such as methods) an object contains, using the built-in function dir():

issue = repo.get_issues()[0]
print(dir(issue))  # in an interactive shell you don't have to print()

This will print:

['CHECK_AFTER_INIT_FLAG', '_CompletableGithubObject__complete', '_CompletableGithubObject__completed', '_GithubObject__makeSimpleAttribute', '_GithubObject__makeSimpleListAttribute', '_GithubObject__makeTransformedAttribute', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_assignee', '_assignees', '_body', '_closed_at', '_closed_by', '_comments', '_comments_url', '_completeIfNeeded', '_completeIfNotSet', '_created_at', '_events_url', '_headers', '_html_url', '_id', '_identity', '_initAttributes', '_labels', '_labels_url', '_locked', '_makeBoolAttribute', '_makeClassAttribute', '_makeDatetimeAttribute', '_makeDictAttribute', '_makeDictOfStringsToClassesAttribute', '_makeIntAttribute', '_makeListOfClassesAttribute', '_makeListOfDictsAttribute', '_makeListOfIntsAttribute', '_makeListOfListOfStringsAttribute', '_makeListOfStringsAttribute', '_makeStringAttribute', '_makeTimestampAttribute', '_milestone', '_number', '_parentUrl', '_pull_request', '_rawData', '_repository', '_requester', '_state', '_storeAndUseAttributes', '_title', '_updated_at', '_url', '_useAttributes', '_user', 'active_lock_reason', 'add_to_assignees', 'add_to_labels', 'as_pull_request', 'assignee', 'assignees', 'body', 'closed_at', 'closed_by', 'comments', 'comments_url', 'create_comment', 'create_reaction', 'created_at', 'delete_labels', 'edit', 'etag', 'events_url', 'get__repr__', 'get_comment', 'get_comments', 'get_events', 'get_labels', 'get_reactions', 'html_url', 'id', 'labels', 'labels_url', 'last_modified', 'lock', 'locked', 'milestone', 'number', 'pull_request', 'raw_data', 'raw_headers', 'remove_from_assignees', 'remove_from_labels', 'repository', 'setCheckAfterInitFlag', 'set_labels', 'state', 'title', 'unlock', 'update', 'updated_at', 'url', 'user']

Here you will also see that it does not include a name 'get_issue_comments', but that it does contain a name 'get_comments'.

Solution

Change the following line:

issue_dict['comments'] = [comment for comment in issue.get_issue_comments()]

to:

issue_dict['comments'] = [comment for comment in issue.get_comments()]
2 of 2
0

For those who can't see comments themselves, to get comments you should get body of comments, like this:

issues['comment'] = [comment.body for comment in issue.get_comments()]
๐ŸŒ
GitHub
github.com โ€บ pygithub โ€บ pygithub โ€บ releases
Releases ยท PyGithub/PyGithub
September 2, 2025 - Typed interactions with the GitHub API v3. Contribute to PyGithub/PyGithub development by creating an account on GitHub.
Author ย  PyGithub
๐ŸŒ
Reddit
reddit.com โ€บ r/learningpython โ€บ need help with pygithub documentation
r/learningpython on Reddit: Need help with PyGithub Documentation
December 15, 2025 -

I'm new to python and have been ramping up recently. The information at realpython.com is invaluable!

I'm trying to make some GitHub integrations and am using the PyGithub api/package/module (I'm unsure of the nomenclature but you get it). I've not yet had too much experience with python api docs, but this seems a bit difficult to parse.

I'm able to eek by using the lsp to help describe the methods/signatures and attribs. But I do need help understanding how to read this documentation. I see some information using the examples, but it's leading to more questions than answers.

Edit: Specifically, I am having difficulty understanding how the chain of actions work. It is not very clear what methods return what, nor is it clear which methods take input, and what input it is.

Top answer
1 of 1
1
I figured it out. It's very not obvious, which is frustrating, but it makes more sense now. The PyGithub api is 1:1 with the github api spec. This means, that the inputs and outputs are also 1:1. The PyGithub API page is to help show you the mapping between the github api and it's own api. For example: The docs show: /repos/{owner}/{repo}/actions/runs/{run_id} GET: github.Repository.Repository.get_workflow_run() or github.Repository.RepositorySearchResult.get_workflow_run() DELETE: github.WorkflowRun.WorkflowRun.delete() and that's it. While it doesn't specify the inputs as run_id within the API documentation, it does show it as required in the GitHub API docs . Parameters for "Get a workflow run" Name, Type, Description | accept string Setting to application/vnd.github+json is recommended. Name, Type, Description | owner string Required The account owner of the repository. The name is not case sensitive. | repo string Required The name of the repository without the .git extension. The name is not case sensitive. | run_id integer Required The unique identifier of the workflow run. Name, Type, Description | exclude_pull_requests boolean If true pull requests are omitted from the response (empty array). Default: false (The formatting is weird, but the sections are "Headers", "Path Parameters", "Query Parameters" respectively. ) That means the code would look like: from github import Github, Auth, UnknownObjectException def get_workflow_run(): """Gets details for a given workflow run""" github_client = Github(auth=Auth.Token("GITHUB_TOKEN")) run_id=1234 repo_name="owner/repo" repo = None run = None try: repo = github_client.get_repo(repo_name) run = repo.get_workflow_run(run_id) except UnknownObjectException: return {"error": f"Workflow run with id {run_id} not found in repository {repo_name}"} return marshal_run(run, verbose=True) (I am still learning, excuse the code if it's not very pythonic. This isn't the actual function I'm going with, it's just a representation for this post.)
๐ŸŒ
PyPI
pypi.org โ€บ project โ€บ PyGithub-requests
PyGithub-requests ยท PyPI
January 29, 2016 - This is PyGithub, but using the requests library instead of httplib.
      ยป pip install PyGithub-requests
    
Published ย  Jan 29, 2016
Version ย  1.26.0