mmyjh86

[파이스탁] pykrx 선물명 스크래핑

Oct 20th, 2019
266
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2.  
  3. # krx.co.kr에서 OTP string 얻기
  4. url = "http://marketdata.krx.co.kr/contents/COM/GenerateOTP.jspx?bld=%2FCOM%2Ffinder_fuisu_combo7&name=selectbox"
  5. otp = requests.get(url).text
  6.  
  7. # 80103 선물 종목 이름 검색
  8. url = "http://marketdata.krx.co.kr/contents/MKD/99/MKD99000001.jspx"
  9. data = {
  10.     "pagePath": "/contents/COM/FinderFuIsu2.jsp",
  11.     "code" : otp
  12. }
  13. response = requests.post(url, data=data).json()
  14. print(response)
RAW Paste Data