hsnam95 / class2022Spring

130 stars 21 forks source link

r=response.json() #4

Open Teng095 opened 2 years ago

Teng095 commented 2 years ago

안녕하세요, 영어음성학응용 강의 수강중인 2020130922 왕텡텡입니다. 과제 중 질문이 생겨 질문드리겠습니다!

r=response.json() r 저도 사실 이것 때문에 문제가 생겼습니다.

JSONDecodeError Traceback (most recent call last)

in () ----> 1 r = response.json() 2 r 3 frames /usr/local/lib/python3.7/dist-packages/requests/models.py in json(self, **kwargs) 896 # used. 897 pass --> 898 return complexjson.loads(self.text, **kwargs) 899 900 @property /usr/lib/python3.7/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 346 parse_int is None and parse_float is None and 347 parse_constant is None and object_pairs_hook is None and not kw): --> 348 return _default_decoder.decode(s) 349 if cls is None: 350 cls = JSONDecoder /usr/lib/python3.7/json/decoder.py in decode(self, s, _w) 335 336 """ --> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end() 339 if end != len(s): /usr/lib/python3.7/json/decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end JSONDecodeError: Expecting value: line 1 column 1 (char 0) 저도 이런 error가 나왔는데 해결방법이 안 나와 어떻게 풀어야 할지 궁금합니다.
Teng095 commented 2 years ago

다른 질문이 하나 더 있습니다.

URL을 작성할 때 요청메시지 명세 나오는 거 다 적어야 하나요?

hsnam95 commented 2 years ago

response만 단독으로 실행해 보고 <Response [200]>이 나오지 않으면 url에 제대로 요청 지정 안해서 그렇습니다. 보통 사용 매뉴얼에 예가 있으니 참조하세요