增加了显示请求头信息的代码

main
mxfqc3yh7 7 months ago
parent 1412f0810a
commit d0c25e9113

21
12.py

@ -1,10 +1,11 @@
import csv import csv
import requests import requests
h={ h={
"User-Agent": "User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"} "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36"}
response=requests.get("https://www.douban.com/",headers=h) response=requests.get("https://www.douban.com/",headers=h)
# response=requests.get("https://tieba.baidu.com/f?kw=%E5%AD%A6%E4%B9%A0%E5%BC%BA%E5%9B%BD&ie=utf-8&pn=50") # response=requests.get("https://tieba.baidu.com/f?kw=%E5%AD%A6%E4%B9%A0%E5%BC%BA%E5%9B%BD&ie=utf-8&pn=50")
print(response.text) print(response.text)
print(response.status_code) print(response.status_code)
print(response.encoding) print(response.encoding)
print(response.request)
Loading…
Cancel
Save