獲取您自己的 Python 伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
import requests #to demonstrate the 'allow_redirects' parameter we use 'http' instead of 'https', w3schools.com automatically redirects http requests to https: url = 'http://w3schools.com/python/demopage.htm' #first, make a request without setting the 'allow_redirects' parameter to False: x = requests.get(url) print(x.text) print("----------------") #then, make a request with the 'allow_redirects' parameter set to False: x = requests.get(url, allow_redirects=False) print(x.text)
<!DOCTYPE html>
<html>
<body>
這是一個測試頁面
</body>
</html>
----------------
檔案已移動 - W3Schools 教學
物件已移動
本文件可以在
這裡
找到