本文整理汇总了Python中github.GitHub.repo方法的典型用法代码示例。如果您正苦于以下问题:Python GitHub.repo方法的具体用法?Python GitHub.repo怎么用?Python GitHub.repo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.GitHub
的用法示例。
在下文中一共展示了GitHub.repo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _make_message
# 需要导入模块: from github import GitHub [as 别名]
# 或者: from github.GitHub import repo [as 别名]
def _make_message(self, message, user, repo):
github = GitHub()
try:
git_user = github.user(user)
except BadUser:
logging.error("Uh oh! {} doesn't seem to be a valid GitHub user.".format(user))
return False
try:
git_repo = github.repo(user, repo)
except BadRepo:
logging.error("Uh oh! Can't connect to {}'s repo {}.".format(user, repo))
return False
# TODO - this is ugly, setup Jinja or some other templating here instead.
message = """
**[{title}]({url})** - *A {language} repository written by [{author}]({author_url})*
> {description}
{stars} stars, {forks} forks
Clone this repository: `{clone}`
---
[I'm a bot](https://github.com/naiyt/autogithubbot) that posts info about GitHub repositories. [Create your own bot](https://github.com/naiyt/reddit-replier)! (Just be nice about it.)
""".format(title=git_repo.name, url=git_repo.url, language=git_repo.language,
description=git_repo.description, author=git_repo.author,
author_url=git_user.url,
stars=git_repo.stars, forks=git_repo.forks, clone=git_repo.clone_url)
return message