Is there some kind of a web-request or something like that so I can list a directory in my github repository in python? I have to check for few files if they are there and they are pretty large so I don´t want to try to download them in my app. I have to just check if they are there.
The only way to do this that I found is to download the html file and then checking right in that file using BeautifulSoup. But this is not very elegant way to do so. In addition I have some troubles with installing BeautifulSoup package for python.
Right now I am using a txt file in which there are all the dlls listed. I run simple script before each commit that generates this text file.
EDIT: I found a solution with the help of PyGithub
from github import Github
g = Github("token")
for repo in g.search_repositories("XtremeUpdater"):
for file in repo.get_contents("dir"):
print(file.name)
Using the get_dir_contents
method worked for me:
import github
g = github.Github("USERNAME", "PASSWORD")
repo = g.get_user().get_repo( "REPO_NAME" )
print repo.get_dir_contents("")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.