Exemplo n.º 1
0
def _hmac_matches(msg, signature):
    if not signature or not signature.startswith('sha1='):
        return False

    return signature[5:] == hmac.new(
        get_config().github.webhook_secret.encode('ascii'),
        msg=msg,
        digestmod=hashlib.sha1,
    ).hexdigest()
Exemplo n.º 2
0
def login():
    """Log in to the GitHub api.

    :return: github3.GitHub object
    """
    config = get_config()
    return github3.login(
        username=config.github.user,
        password=config.github.password,
    )