I'm learning how to work with JSON in python3 (specifically working in anaconda) and I've trying to run this snippet:
import requests
import json
response = json.loads(requests.get("https://jsonplaceholder.typicode.com/todos").text)
but I keep getting this error:
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
I can't seem to figure out why this happens. I'm sort of new to this - thanks for the help.
edit: so I ran this on a different IDE and it worked, but it still refuses to work Spyder...
我只需要重新启动我的IDE ...谢谢大家!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.