Exemplo n.º 1
0
def search():
    """Handle search requests
    """

    query_args = APP.current_request.query_params
    query_args = query_args if isinstance(query_args, dict) else {}

    path = query_args['path']
    row = query_args['row']
    sensor = query_args['sensor']

    data = list(cbers_search(path, row, sensor))
    info = {
        'request': {
            'path': path,
            'row': row,
            'sensor': sensor
        },
        'meta': {
            'found': len(data)
        },
        'results': data
    }

    return ('OK', 'application/json', json.dumps(info))
Exemplo n.º 2
0
def search(path: str, row: str) -> Tuple[str, str, str]:
    """Handle search requests."""
    data = list(cbers_search(path, row))
    info = {
        "request": {"path": path, "row": row},
        "meta": {"found": len(data)},
        "results": data,
    }
    return ("OK", "application/json", json.dumps(info))
Exemplo n.º 3
0
def search(event, context):
    """Handle search requests."""
    path = event['path']
    row = event['row']
    data = list(cbers_search(path, row))
    info = {
        'request': {
            'path': path,
            'row': row
        },
        'meta': {
            'found': len(data)
        },
        'results': data
    }
    return info
Exemplo n.º 4
0
def search(path, row):
    """Handle search requests."""
    if not path:
        raise CbersTilerError("Missing 'path' parameter")
    if not row:
        raise CbersTilerError("Missing 'row' parameter")

    data = list(cbers_search(path, row))
    info = {
        "request": {
            "path": path,
            "row": row
        },
        "meta": {
            "found": len(data)
        },
        "results": data,
    }

    return ("OK", "application/json", json.dumps(info))