Requests.get('url')返回TypeError super(type,obj):obj必须是类型的实例或子类型

时间:2019-01-23 19:18:18

标签: python json python-requests

我正在学习如何在python3中使用JSON(特别是在anaconda中工作),并且我试图运行此代码段:

import requests
import json

response = json.loads(requests.get("https://jsonplaceholder.typicode.com/todos").text)

但我不断收到此错误:

Traceback (most recent call last):
  File "<ipython-input-54-4ad14477a807>", line 1, in <module>
    response = json.loads(requests.get("https://jsonplaceholder.typicode.com/todos").text)
  File "C:\Users\ivan.sheng\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\ivan.sheng\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\api.py", line 59, in request
    with sessions.Session() as session:
  File "C:\Users\ivan.sheng\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\sessions.py", line 417, in __init__
    self.mount('https://', HTTPAdapter())
  File "C:\Users\ivan.sheng\AppData\Local\Continuum\anaconda3\lib\site-packages\requests\adapters.py", line 123, in __init__
    super(HTTPAdapter, self).__init__()
TypeError: super(type, obj): obj must be an instance or subtype of type

我似乎无法弄清楚为什么会这样。我对此很陌生-感谢您的帮助。

编辑:所以我在另一个IDE上运行了它,但是它仍然无法工作Spyder ...

1 个答案:

答案 0 :(得分:0)

我只需要重新启动我的IDE ...谢谢大家!