Read content of file which is in Github using pyGithub?

Let say "sample.txt" file is in GitHub under "Demo" repo [Demo/sample.txt], how can I read the content of sample.txt using pyGithub instead fetching from API ? Else do we have someother package to read such file content ?


You can use this code for see the content of the file:

from github import Github
github = Github('user', 'password')
user = github.get_user()
repository = user.get_repo('Demo')
file_content = repository.get_contents('sample.txt')

if you need see more atributes like decoded_content just type this:


And sorry for me english, I'm bad.

Posted on by Anonymous