티스토리 뷰
Requirements
- Editor : VScode
- python 3.10
- requests 2.28.1 : builtin function
- BeautifulSoup4 4.11.1 : pip3 install
1. 공공데이터포탈 회원가입 및 데이터 활용신청
web site : data.go.kr
검색어 굴뚝
데이터활용신청하기
오픈 API : 한국환경공단 굴뚝자동측정기기 측정결과
활용신청
마이페이지
... 아래 인증키 생성
code 작성에 필요한 요청변수 및 출력결과 예시
2. python code
# -*- coding: utf-8 -*-
# python3의 경우 삭제
from urllib.parse import urlencode, unquote
import requests
import pprint
import json
url = 'http://apis.data.go.kr/B552584/cleansys/rltmMesureResult'
idkey = '[YOURKEY]'
# queryString
queryString="?" + urlencode(
{
'serviceKey' : unquote(idkey),
'areaNm' : '충청북도',
'factManageNm' : '한세이프에너지㈜',
'stackCode' : '1',
'type' : 'json'
}
)
queryURL = url + queryString
response = requests.get(queryURL)
print(response)
r_dic = json.loads(response.text)
print(r_dic)
Terminal
<Response [200]>
{'response': {'header': {'resultCode': '0', 'totalCount': 1, 'resultMsg': 'NORMAL_CODE'},
'body': {'items': [{'nh3_mesure_value': None, 'mesure_dt': '2022-10-14 11:30',
'nox_exhst_perm_stdr_value': '59.5', 'sox_mesure_value': '0.35',
'hf_mesure_value': None, 'sox_exhst_perm_stdr_value': '24',
'nox_mesure_value': '31.59', 'hcl_exhst_perm_stdr_value': '12',
'tsp_exhst_perm_stdr_value': '16', 'area_nm': '충청북도',
'nh3_exhst_perm_stdr_value': None, 'hf_exhst_perm_stdr_value': None,
'co_mesure_value': '24.72', 'fact_manage_nm': '한세이프에너지㈜',
'tsp_mesure_value': '4.51', 'stack_code': '1', 'hcl_mesure_value': '0.13',
'co_exhst_perm_stdr_value': '180'}]}}}
json data가 출력되니 잘 요리해서 활용
반응형
'python > Data Science' 카테고리의 다른 글
(macOS)[python] curve fitting : (2) interpolation with scipy (0) | 2022.11.04 |
---|---|
(macOS)[python] curve fitting : (1) regression with scipy/numpy (0) | 2022.11.03 |
(macOS)[python] 파일이름 encoding, 한글 자모분리 해결 (0) | 2022.02.27 |
(macOS)[python] 기상청 RSS 서비스를 이용한 데이터 parsing (0) | 2021.02.15 |
(macOS)[python] IP address 확인 : Public/Pravate(Virtual) (0) | 2021.02.15 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 자가격리
- vscode
- Raspberry Pi
- r
- CSV
- COVID-19
- Python
- 코로나
- arduino
- 코로나19
- git
- sublime text
- 라즈베리파이
- Templates
- MacOS
- DS18B20
- Django
- Pandas
- 확진
- DAQ
- raspberrypi
- SSH
- template
- server
- github
- Regression
- ERP
- Model
- pyserial
- analysis
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함