Skip to main content

공공데이터포털 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


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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataportal-0.0.6-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file dataportal-0.0.6.tar.gz.

File metadata

  • Download URL: dataportal-0.0.6.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for dataportal-0.0.6.tar.gz
Algorithm Hash digest
SHA256 a0304ed5eb60f81153abc096fa903bee6adcbc50bec9ccf662e26148768fc61e
MD5 29c76d204bb1bafe8df67bf109145bc5
BLAKE2b-256 c6842c80d756d1f2dac8ab039134eda64597c33814378cdbd03eb43517606933

See more details on using hashes here.

File details

Details for the file dataportal-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: dataportal-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for dataportal-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b17b8468a6e9d2bca55716ca9b85f2d2a436df59f18d0ae8c4dc986c8c900af1
MD5 8cff5e07f469abff5a8f9684c0c96a76
BLAKE2b-256 ffc7b442610c651ce0936de97ca9ca23950609a6c9521940ac9e909eef917674

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page