我想知道我应该调用哪个方法(和其对象),以及如何调用该方法(需要的参数和它们的含义)。
import github
g = github.Github(token)
# or g = github.Github(login, password)
repo = g.get_user().get_repo("repo_name")
file = repo.get_file_contents("/your_file.txt")
# update
repo.update_file("/your_file.txt", "your_commit_message", "your_new_file_content", file.sha)
如果您使用的令牌,那么你至少应该有回购您的令牌的范围内做到这一点。https://developer.github.com/v3/oauth/#scopes
参见: https : //developer.github.com/v3/repos/contents/和https://github.com/PyGithub/PyGithub
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句