Created
September 5, 2018 14:24
-
-
Save inasie/23b6fcd13633f3f363e8e403af5be7d8 to your computer and use it in GitHub Desktop.
국토교통부 아파트 실거래가 크롤러 예제
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import json | |
import logging | |
URL = "http://rt.molit.go.kr/new/gis/getDanjiInfoDetail.do" | |
param = { | |
'menuGubun': 'A', | |
'p_apt_code': 20064683, | |
'p_house_cd': 1, | |
'p_acc_year': 2018 | |
} | |
header = { | |
'Referer': 'http://rt.molit.go.kr/new/gis/srh.do?menuGubun=A&gubunCode=LAND' | |
} | |
logging.basicConfig(level=logging.INFO) | |
resp = requests.get(URL, params=param, headers=header) | |
if resp.status_code != 200: | |
logging.error('invalid status: %d' % resp.status) | |
exit | |
data = json.loads(resp.text) | |
for item in data['result']: | |
if item['BLDG_AREA'] < 80 or item['BLDG_AREA'] > 85: | |
continue | |
logging.info('%02s월 %02s층 %s만원' % (item['DEAL_MM'], item['APTFNO'], item['SUM_AMT'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment