hsnam95 / class2022Spring

130 stars 22 forks source link

r=response.json() #7

Open juyoung524 opened 2 years ago

juyoung524 commented 2 years ago

안녕하세요, 저는 영어음성학응용 수업을 수강하고 있는 2018130874 영어영문학과 강주영입니다.

r=response.json() 코드 실행 중 다음과 같은 문제가 생겨 여쭤봅니다..!

JSONDecodeError Traceback (most recent call last) in () ----> 1 r = response.json() 2 r

3 frames /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)

  1. 문제가 발생한 원인
  2. 해결 방법 이 궁금합니다ㅠㅠ!
juyoung524 commented 2 years ago

!pip install gradio import gradio as gr import requests import pandas as pd

URL = ('http://apis.data.go.kr/6260000/BusanTblFnrstrnStusService/' 'getTblFnrstrnStusInfo?' 'serviceKey=JLSeGuX9n3W0EMfx1ajNjY3tb7UDmE0ktk7OnePFxnckUei%2FYuA8GEI8omQVAWXSPwvWy09fPyxyU13K5XnMVw%3D%3D' '&numOfRows=10&pageNo=1' '&returnType=json') response = requests.get(URL)

response

혹시 답변에 필요하실까 해서 Full 코드도 올려봅니다!

hsnam95 commented 2 years ago

https://www.data.go.kr/data/15034029/openapi.do 매뉴얼을 잘 읽어 보면 JSON방식으로 호출 시 파라미터 resultType=json 입력하라고 되어 있습니다. returnType으로 말고요.

juyoung524 commented 2 years ago

교수님 감사합니다!