首页 > Web开发 > 详细

httpx使用HTTP/2

时间:2020-09-27 21:57:24      阅读:203      评论:0      收藏:0      [点我收藏+]
import httpx
client = httpx.Client(http2=True, verify=False)
headers = {
    ‘Host‘: ‘pixabay.com‘,
    ‘upgrade-insecure-requests‘: ‘1‘,
    ‘user-agent‘: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36‘,
    ‘accept‘: ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9‘,
    ‘sec-fetch-site‘: ‘none‘,
    ‘sec-fetch-mode‘: ‘navigate‘,
    ‘sec-fetch-dest‘: ‘document‘,
    ‘accept-language‘: ‘zh-CN,zh;q=0.9‘
}

response = client.get(‘https://pixabay.com/images/search/cat/‘, headers=headers)
print(response.text)

httpx使用HTTP/2

原文:https://www.cnblogs.com/c-x-a/p/13741342.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!