hyperion/api/crime.py
async def api_neighbourhood(request):
    """
    Gets police data about a neighbourhood.
    :param request: The aiohttp request.
    :return: The police data for that post code.
    """
    postcode: Optional[str] = request.match_info.get('postcode', None)

    try:
        postcode = (await get_postcode_random()) if postcode == "random" else postcode
        neighbourhood = await get_neighbourhood(postcode)
    except CachingError as e:
        raise web.HTTPInternalServerError(text=e.status)

    if neighbourhood is None:
        raise web.HTTPNotFound(text="No Police Data")
    else:
        return str_json_response(neighbourhood.serialize())
async def api_neighbourhood(request):
    """
    Gets police data about a neighbourhood.
    :param request: The aiohttp request.
    :return: The police data for that post code.
    """
    postcode: Optional[str] = request.match_info.get('postcode', None)

    try:
        postcode = (await get_postcode_random()) if postcode == "random" else postcode
        neighbourhood = await get_neighbourhood(postcode)
    except CachingError as e:
        raise web.HTTPInternalServerError(text=e.status)

    if neighbourhood is None:
        raise web.HTTPNotFound(text="No Police Data")
    else:
        return str_json_response(neighbourhood.serialize())
async def api_neighbourhood ( request ) : postcode : Optional [ str ] = request . match_info . get ( 'postcode' , None ) try : postcode = ( await get_postcode_random ( ) ) if postcode == "random" else postcode neighbourhood = await get_neighbourhood ( postcode ) except CachingError as e : raise web . HTTPInternalServerError ( text = e . status ) if neighbourhood is None : raise web . HTTPNotFound ( text = "No Police Data" ) else : return str_json_response ( neighbourhood . serialize ( ) )
Gets police data about a neighbourhood.
    :param request: The aiohttp request.
    :return: The police data for that post code.
Gets police data about a neighbourhood . : param request : The aiohttp request . : return : The police data for that post code .