为什么尝试进行webscrape时会不断出现“类型错误”问题?

时间:2019-07-26 17:06:13

标签: python python-requests

为什么当我运行

时,为什么不断收到此“ TypeError: init ()收到意外的关键字参数'strict'”
  
    
      

res = requests.get('https://automatetheboringstuff.com/files/rj.txt')

    
  
Traceback (most recent call last):

  File "<stdin>", line 1, in <module
>
  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 49, in get

    return request('get', url, **kwargs)

  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\api.py", line 38, in request

    return session.request(method=method, url=url, **kwargs)

File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 232, in _get_conn

 return conn or self._new_conn()

  File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 199, in _new_conn
    strict=self.strict)

TypeError: __init__() got an unexpected keyword argument 'strict'

1 个答案:

答案 0 :(得分:0)

解决方案是使用最新版本的请求:)