import requests
url = 'https://book.douban.com/subject/25862578/comments/'
headers = {'User- Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3861.400 QQBrowser/10.7.4313.400'}
r = requests.get(url, headers = headers, Timeout=(3.05, 27))
运行之后出现报错
TypeError: request() got an unexpected keyword argument 'Timeout'
requests版本
pip show requests
Name: requests
Version: 2.25.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: e:\anaconda\lib\site-packages
Requires: chardet, urllib3, idna, certifi
Required-by: Sphinx, jupyterlab-server, conda, conda-build, anaconda-project, anaconda-client
Note: you may need to restart the kernel to use updated packages.