【python】requests请求使用http1.0版本

2018-08-07  本文已影响0人  wander_zwh

针对对python2.x版本:

import httplib

import requests

httplib.HTTPConnection._http_vsn = 10

httplib.HTTPConnection._http_vsn_str = 'HTTP/1.0'

r = requests.get('http://127.0.0.1:8888/')

针对python3.x版本:

from http import client

import requests

client.HTTPConnection._http_vsn=10

client.HTTPConnection._http_vsn_str='HTTP/1.0'

a=requests.get(''http://127.0.0.1:8888/')

上一篇下一篇

猜你喜欢

热点阅读