hyperion/fetch/police.py
async def fetch_crime(lat: float, long: float) -> List[Dict]:
    """
    Gets crime for a given lat and long.
    :raise ApiError: When there was an error connecting to the API.

    todo cache
    """
    crime_lookup = f"https://data.police.uk/api/crimes-street/all-crime?lat={lat}&lng={long}"
    async with ClientSession() as session:
        try:
            async with session.get(crime_lookup) as request:
                crime_request = await request.json()
        except ClientConnectionError as con_err:
            logger.debug(f"Could not connect to {con_err.args[0].pool.host}")
            raise ApiError(f"Could not connect to {con_err.args[0].pool.host}")
        except JSONDecodeError as dec_err:
            logger.error(f"Could not decode data: {dec_err}")
            raise ApiError(f"Could not decode data: {dec_err}")
        else:
            return crime_request
async def fetch_crime(lat: float, long: float) -> List[Dict]:
    """
    Gets crime for a given lat and long.
    :raise ApiError: When there was an error connecting to the API.

    todo cache
    """
    crime_lookup = f"https://data.police.uk/api/crimes-street/all-crime?lat={lat}&lng={long}"
    async with ClientSession() as session:
        try:
            async with session.get(crime_lookup) as request:
                crime_request = await request.json()
        except ClientConnectionError as con_err:
            logger.debug(f"Could not connect to {con_err.args[0].pool.host}")
            raise ApiError(f"Could not connect to {con_err.args[0].pool.host}")
        except JSONDecodeError as dec_err:
            logger.error(f"Could not decode data: {dec_err}")
            raise ApiError(f"Could not decode data: {dec_err}")
        else:
            return crime_request
async def fetch_crime ( lat : float , long : float ) -> List [ Dict ] : crime_lookup = f"https://data.police.uk/api/crimes-street/all-crime?lat={lat}&lng={long}" async with ClientSession ( ) as session : try : async with session . get ( crime_lookup ) as request : crime_request = await request . json ( ) except ClientConnectionError as con_err : logger . debug ( f"Could not connect to {con_err.args[0].pool.host}" ) raise ApiError ( f"Could not connect to {con_err.args[0].pool.host}" ) except JSONDecodeError as dec_err : logger . error ( f"Could not decode data: {dec_err}" ) raise ApiError ( f"Could not decode data: {dec_err}" ) else : return crime_request
Gets crime for a given lat and long.
    :raise ApiError: When there was an error connecting to the API.

    todo cache
Gets crime for a given lat and long . : raise ApiError : When there was an error connecting to the API .