【发布时间】:2017-07-03 10:08:55
【问题描述】:
我在 Python 中尝试过以下代码
url="http://www.realtor.com/realestateandhomes-search/Pittsburgh_PA/type-single-family-home/price-na-30000/sby-1/"
r=requests.get(url)
但它会引发错误
File "C:\Users\Dana\AppData\Local\Programs\Python\Python35-32\lib\site-package
s\requests\sessions.py", line 630, in send
history = [resp for resp in gen] if allow_redirects else []
File "C:\Users\Dana\AppData\Local\Programs\Python\Python35-32\lib\site-package
s\requests\sessions.py", line 630, in <listcomp>
history = [resp for resp in gen] if allow_redirects else []
File "C:\Users\Dana\AppData\Local\Programs\Python\Python35-32\lib\site-package
s\requests\sessions.py", line 111, in resolve_redirects
raise TooManyRedirects('Exceeded %s redirects.' % self.max_redirects, respon
se=resp)
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.
任何帮助将不胜感激
【问题讨论】:
标签: python python-3.x python-requests