def send_with_naive_timing(session, url, token):
# Prepare the request this way to avoid the auto-added User-Agent and Accept
# headers.
#
# TODO: What happens if I want to send data? Do I need to add the
# Content-Type header manually?
req = requests.Request('GET',
url,
headers={'Authorization': 'Token %s' % token,
'Accept-Encoding': 'identity'}
)
prepared_request = req.prepare()
response = session.send(prepared_request,
allow_redirects=False,
verify=False)
naive_time = response.elapsed.microseconds
return response, naive_time
评论列表
文章目录