I want to calculate the delay between a client sending a request to my flask api and my flask api receiving the request. Right now I'm trying this:
@current_app.before_request
def before_request():
print(request.date)
But I am printing None
Flask's documentation states this will work here: http://werkzeug.pocoo.org/docs/0.14/wrappers/#werkzeug.wrappers.CommonRequestDescriptorsMixin.date
Those flask docs are referencing the Date
header. It will print None
unless the Date
header is specified in the request.
The MDN Docs for header show you the format of the header. Send a request with that header and you'll have the information you need.
If you can't control the client sending your requests, I don't think there is a way to achieve what you're looking for.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.