【发布时间】:2019-12-31 05:24:42
【问题描述】:
如何在 python 中检查网站内容类型
import requests
from bs4 import BeautifulSoup as bs
headers = { 'User-Agent': 'Mozilla/5.0',
'Content-Type': '???',
'Referer': 'https://www.manta.com/mb_43_A0_02/advertising_and_marketing/alaska?fbclid=IwAR3gfnW_bma08cITjmctgdcS5hLRau0vwl6WJHXdbwL9U3FkxIgrLkOG5rs',
'X-Requested-With': 'XMLHttpRequest'}
如何在 python 中查找内容类型我想抓取这个网站:
【问题讨论】:
-
你使用的是哪个http客户端库?
-
@CoreyGoldberg 问题已更新
-
Content-Type描述了您发送或接收的数据类型。 developer.mozilla.org/es/docs/Web/HTTP/Headers/Content-Type 如果您只是请求数据 (GET),那么服务器会告诉您Content-Type是什么。你不告诉它。
标签: python web-scraping web-crawler