DB_JOB/작업파일/공공기관3/완료/4.한국인터넷진흥원/_probe4.py
2026-06-26 09:47:44 +09:00

16 lines
625 B
Python

# coding: utf-8
import requests, json
H={'User-Agent':'Mozilla/5.0','Referer':'https://www.kisa.or.kr/20207','X-Requested-With':'XMLHttpRequest'}
u='https://www.kisa.or.kr/selectTabList.do'
r=requests.get(u,headers=H,params={'menu_seq':20207,'lang_type':'KO'},timeout=20)
print('status',r.status_code,'ctype',r.headers.get('content-type'))
print('raw len',len(r.text))
try:
data=r.json()
print('JSON array len',len(data))
for d in data:
print(' seq=%s name=%r ctype=%s'%(d.get('menu_seq'),d.get('menu_name'),d.get('content_type')))
except Exception as e:
print('not json:',e)
print(r.text[:800])