누군가가이 python API 호출 프로그램을 도와 줄 수 있습니까? json의 특정 부분을 표시하는 방법은 무엇입니까?
import json
from pprint import pprint
import requests
weather = requests.get('http://api.openweathermap.org/data/2.5/weather?
q=London&APPID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
pprint(weather.json())
wjson = weather.read()
wjdata = json.load(weather)
print (wjdata['temp_max'])
그래서이 코드 조각 나는 그것이 제대로 인쇄 날씨 API에서 정보를 얻으려고하지만 특정 값을 선택하려는 경우에만 나는이 오류가 발생합니다.
Traceback (most recent call last):
File "gawwad.py", line 7, in <module>
wjson = weather.read()
AttributeError: 'Response' object has no attribute 'read'