from bs4 import BeautifulSoup
import requests
url = "http://www.ticketcity.com/kansas-city-tickets/arrowhead-stadium-tickets/arizona-cardinals-at-kansas-city-chiefs-nov-11-2018-2653648.html"
headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0' }
html = requests.get(url, headers = headers)
ConnectionError :(“连接已中止。”,RemoteDisconnected(“远程 结束无响应的关闭连接',))
任何人都可以帮助解决这个问题吗?
答案 0 :(得分:0)
您的参数不匹配。通过删除秒headers
来解决此问题:
In [48]: from bs4 import BeautifulSoup
...:
...: import requests
...:
...: url = "http://www.ticketcity.com/kansas-city-tickets/arrowhead-stadium-tickets/arizona-cardinals-at-kansas-city-chiefs-nov-11-2018-2653648.html"
...:
...: headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0' }
...:
...: html = requests.get(url, headers)
...:
...:
In [49]:
In [49]: html.status_code
Out[49]: 200