def on_new_request(event): request = event.request # Save the time the request was received by the server. event.request._received_at = utils.msec_time() # New logger context, with infos for request summary logger. logger.new(agent=request.headers.get('User-Agent'), path=event.request.path, method=request.method, querystring=dict(request.GET), lang=request.headers.get('Accept-Language'), uid=None, authn_type=None, errno=None)
def on_new_request(event): request = event.request # Save the time the request was received by the server. event.request._received_at = utils.msec_time() try: # Pyramid fails if the URL contains invalid UTF-8 characters. request_path = event.request.path except UnicodeDecodeError: raise errors.http_error(HTTPBadRequest(), errno=errors.ERRORS.INVALID_PARAMETERS, message="Invalid URL path.") # New logger context, with infos for request summary logger. logger.new(agent=request.headers.get('User-Agent'), path=request_path, method=request.method, querystring=dict(request.GET), lang=request.headers.get('Accept-Language'), uid=None, authn_type=None, errno=None)
def on_new_request(event): request = event.request # Save the time the request was received by the server. event.request._received_at = utils.msec_time() try: # Pyramid fails if the URL contains invalid UTF-8 characters. request_path = event.request.path except UnicodeDecodeError: raise errors.http_error( HTTPBadRequest(), errno=errors.ERRORS.INVALID_PARAMETERS, message="Invalid URL path.") # New logger context, with infos for request summary logger. logger.new(agent=request.headers.get('User-Agent'), path=request_path, method=request.method, querystring=dict(request.GET), lang=request.headers.get('Accept-Language'), uid=None, authn_type=None, errno=None)