Requests中的JSON解码器

>>> import requests
>>> r = requests.get('https://github.com/timeline.json')
>>> r.json()
[{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...
如果JSON解码失败, r.json 就会抛出一个异常。

响应内容为json时使用json()进行解码,如果格式不是json则会解码失败抛出异常

posted @ 2020-12-15 17:02  sriver_dl  Views(297)  Comments(0Edit  收藏  举报