plus1.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ghutil 作者: jwodder 项目源码 文件源码
def cli(ctx, url):
    """ Thumb-up issues, PRs, or comments thereon """
    for u in url:
        m = re.fullmatch(r'(?:https?://)?(?:www\.)?github\.com'
                         r'/(?P<owner>[^/]+)'
                         r'/(?P<repo>[^/]+)'
                         r'/(?:issues|pull)'
                         r'/(?P<issue>\d+)'
                         r'(?:#issuecomment-(?P<comment>\d+))?', u)
        if not m:
            click.echo('{}: could not parse {!r}'.format(ctx.command_path, u),
                       err=True)
            continue
        endpoint = ctx.obj.repos[m.group('owner')][m.group('repo')].issues
        if m.group('comment') is None:
            endpoint = endpoint[m.group('issue')].reactions
        else:
            endpoint = endpoint.comments[m.group('comment')].reactions
        endpoint.post(json={"content": "+1"})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号