(request)
return data
Pass request object and returns parsed data dict.
    Country is fetched from IP using maxmind db.

    :param request:
    :return:
Pass request object and returns parsed data dict.
    Country is fetched from IP using maxmind db.
Pass request object and returns parsed data dict . Country is fetched from IP using maxmind db .
def parse_request(request):
    """Pass request object and returns parsed data dict.
    Country is fetched from IP using maxmind db.

    :param request:
    :return:
    """
    ip = request.environ.get('HTTP_X_REAL_IP', request.remote_addr)
    data = dict(
        referrer=request.referrer,
        user_agent=request.headers.get("User-Agent"),
        country=ip_country(ip)
    )
    return data
def parse_request ( request ) : ip = request . environ . get ( 'HTTP_X_REAL_IP' , request . remote_addr ) data = dict ( referrer = request . referrer , user_agent = request . headers . get ( "User-Agent" ) , country = ip_country ( ip ) ) return data