Last active
July 14, 2017 02:45
-
-
Save nck2/dbfdd587a88c0475a199f00b2599f0c0 to your computer and use it in GitHub Desktop.
[Q]고등학교급식크롤링
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
# 크롤링 주소 : http://stu.sen.go.kr/edusys.jsp?page=sts_m42310 | |
# 서울고등학교의 월간식단을 아래와 같이 크롤링시도 | |
# 응답실패 | |
import requests | |
from bs4 import BeautifulSoup | |
stuurl="http://stu.sen.go.kr/sts_sci_md00_001.ws" | |
request_headers = { | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36', | |
'Content-Type': 'application/json', | |
'Referer': 'http://stu.sen.go.kr/edusys.jsp?page=sts_m42310', | |
} | |
payload={"ay":"2017","mm":"07","insttNm":"서울고등학교","schulCode":"B100000456","schulKndScCode":"04","schulCrseScCode":"4"} | |
html2=requests.post(stuurl,headers=request_headers,params=payload) | |
print(html2.text) | |
''' 결과 | |
{"wsActionMappingSVO":{"actionId":"/sts_sci_md00_001.ws","charset":"UTF-8","formName":"","forwardOnlyFlag":"N","forwardPage":"/edusys/pa/sts/sci/md/sts_scimd00_m00","inData":{},"method":"listMonthlyDiet","outData":null,"sessionForm":"","showNewForm":"","svcId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVC","svo":{"ay":"","comData":{"method":"listMonthlyDiet","globCorpCd":"","resultMsg":"","dept":"","userId":"","ip":"","resultCode":"","commitYn":"","lang":"","useSession":"","voId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVO","svcId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVC","testExeSeq":""},"commitYn":"","data":{"schYm":"","schYmd":"","schMmealScCode":"","rdData":"","schSchulCode":"","schulCode":"","schulKndScCode":"","schulCrseScCode":"","insttNm":"","ay":"","mm":""},"dept":"","dietNtrList":[],"flag":"","globCorpCd":"","insttNm":"","ip":"","lang":"","method":"listMonthlyDiet","mm":"","mthDietList":[],"mthDietListJson":null,"orplcList":[],"rdData":"","requestSenderID":"","requestTargetAction":"","resultCode":"","resultMsg":"","schMmealScCode":"","schSchulCode":"","schYm":"","schYmd":"","schulCode":"","schulCrseScCode":"","schulKndScCode":"","svcId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVC","terminalType":"","testExeSeq":"","transactionID":"","useSession":"","userId":"","voId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVO","weekDietList":[]},"title":"월간식단","voId":"edusys.pa.spr.sci.md.svc.SprSciMd00M00SVO"},"exceptionOccur":"true","result":{"status":"error","message":"서비스 처리에 실패했습니다."},"action_title":"월간식단"} | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment