How to use the gidgethub.routing.Router function in gidgethub

To help you get started, we’ve selected a few gidgethub examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github python / miss-islington / miss_islington / View on Github external
import sys
import traceback
import cachetools

from aiohttp import web

from gidgethub import aiohttp as gh_aiohttp
from gidgethub import routing
from gidgethub import sansio

from . import backport_pr
from . import delete_branch
from . import status_change

router = routing.Router(backport_pr.router, delete_branch.router, status_change.router)

cache = cachetools.LRUCache(maxsize=500)

import sentry_sdk


async def main(request):
        body = await

        secret = os.environ.get("GH_SECRET")
        event = sansio.Event.from_http(request.headers, body, secret=secret)
        print("GH delivery ID", event.delivery_id, file=sys.stderr)
        if event.event == "ping":
github python / bedevere / bedevere / View on Github external
"""Automatically remove a backport label, and check backport PR validity."""
import functools
import re

import gidgethub.routing

from . import util

create_status = functools.partial(util.create_status, 'bedevere/maintenance-branch-pr')

router = gidgethub.routing.Router()

TITLE_RE = re.compile(r'\s*\[(?P\d+\.\d+)\].+\((?:GH-|#)(?P\d+)\)')
MAINTENANCE_BRANCH_TITLE_RE = re.compile(r'\s*\[(?P\d+\.\d+)\].+')
MAINTENANCE_BRANCH_RE = re.compile(r'\s*(?P\d+\.\d+)')
BACKPORT_LABEL = 'needs backport to {branch}'
MESSAGE_TEMPLATE = ('[GH-{pr}]({pr}) is '
                    'a backport of this pull request to the '
                    '[{branch} branch]({branch}).')


async def _copy_over_labels(gh, original_issue, backport_issue):
    """Copy over relevant labels from the original PR to the backport PR."""
    label_prefixes = "skip", "type", "sprint"
    labels = list(filter(lambda x: x.startswith(label_prefixes),