INNER CODE UNIT · Python

parse_request_path

lebinh/ngxtop · ngxtop/ngxtop.py:279

def parse_request_path(record):
    if 'request_uri' in record:
        uri = record['request_uri']
    elif 'request' in record:
        uri = ' '.join(record['request'].split(' ')[1:-1])
    else:
        uri = None
    return urlparse.urlparse(uri).path if uri else None


def parse_status_type(record):
    return record['status'] // 100 if 'status' in record else None


def to_int(value):
    return int(value) if value and value != '-' else 0

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…