timing-collector.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pico 作者: andresriancho 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号