공공데이터포털 api 다운로드
Project description
dataportal
공공데이터포털 api를 이용하여 데이터를 다운로드 하기 위한 라이브러리입니다.
xml의 경우 OrderedDict
형태로 데이터를 불러오고 json의 경우 json
형태로 데이터를 불러옵니다.
Guide
사용법은 매우 간단합니다. (예시를 위해 기상청 일기도 api를 활용하였습니다.)
아래와 같이 response부분과 데이터 다운로드 부분을 분리하여 할수도 있고
url = 'http://apis.data.go.kr/1360000/WthrChartInfoService'
serviceKey = 'Test'
operation = 'getSurfaceChart'
params = {'code' : 12, 'time' : '20211118'}
dataportal = DataportalApi(url, serviceKey, operation, params)
dataportal.get_request_query()
api_out = dataportal.parse_response()
print(api_out.head())
아래와 같이 모든 과정을 한번에 처리할 수도 있습니다.
url = 'http://apis.data.go.kr/1360000/WthrChartInfoService'
serviceKey = 'Test'
operation = 'getSurfaceChart'
params = {'code' : 12, 'time' : '20211118'}
dataportal = DataportalApi(url, serviceKey, operation, params)
api_out = dataportal.load(verbose=False)
print(api_out.head())
Requires
- xmltodict>=0.12.0
- requests>=2.25.1
- urllib3>=1.26.4
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dataportal-0.0.6.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for dataportal-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b17b8468a6e9d2bca55716ca9b85f2d2a436df59f18d0ae8c4dc986c8c900af1 |
|
MD5 | 8cff5e07f469abff5a8f9684c0c96a76 |
|
BLAKE2b-256 | ffc7b442610c651ce0936de97ca9ca23950609a6c9521940ac9e909eef917674 |