【发布时间】:2019-04-05 22:27:05
【问题描述】:
我一直在关注 YouTube 上的指南,但一直坚持使用正确的用户代理来通过 HTTP 403 Forbidden
这是我正在尝试的代码:
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
my_url = "https://www.pedidosya.com.ar/restaurantes/buenos-aires/monserrat/empanadas-delivery"
headers = {'User-Agent':user_agent,}
uReq(my_url)
【问题讨论】:
标签: python beautifulsoup http-status-code-403