# coding:utf-8
import requests
# 请求地址
# url = "https://www.qlchat.com"
url = "https://www.baidu.com"
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chro'
'me/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400'
}
r = requests.get(url,headers=headers,verify=False)
print(r.status_code)
print(r.text)
然后修改:
# coding:utf-8
import requests
# 请求地址
# url = "https://www.qlchat.com"
url = "https://www.baidu.com/xxx"
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chro'
'me/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400'
}
r = requests.get(url,headers=headers,verify=False)
print(r.status_code)
print(r.text)
------返回------
404
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /xxx was not found on this server.</p>
</body></html>
标签:www,url,扫描,站点,headers,537.36,https,requests From: https://blog.51cto.com/u_11908275/6386043