获取您自己的
Python
服务器
×
更改方向
更改主题,深色/浅色
前往Spaces
import requests url = 'https://w3schools.com/python/demopage.asp' #use the 'headers' parameter to set the HTTP headers: x = requests.get(url, headers = {"HTTP_HOST": "MyVeryOwnHost"}) print(x.text) #the 'demopage.asp' prints all HTTP Headers
HTTP_CONNECTION:keep-alive
HTTP_ACCEPT:*/*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_HOST:MyVeryOwnHost
HTTP_USER_AGENT:python-requests/2.22.0