Last active
March 16, 2019 09:29
-
-
Save NeedPainkiller/77b8d6555d76422247a2cb00d5020516 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
import sys | |
import requests | |
import xml.etree.ElementTree as ElementTree | |
PostUrl = "https://teht.hometax.go.kr/wqAction.do?actionId=ATTABZAA001R08&screenId=UTEABAAA13&popupYn=false&realScreenId=" | |
XmlRaw = "<map id=\"ATTABZAA001R08\"><pubcUserNo/><mobYn>N</mobYn><inqrTrgtClCd>1</inqrTrgtClCd><txprDscmNo>\{CRN\}</txprDscmNo><dongCode>15</dongCode><psbSearch>Y</psbSearch><map id=\"userReqInfoVO\"/></map>" | |
def call(crn): | |
res = requests.post(PostUrl, data=XmlRaw.replace("\{CRN\}", crn), headers={'Content-Type': 'text/xml'}) | |
xml = ElementTree.fromstring(res.text).findtext("trtCntn") | |
result = crn + "\t" + xml.replace("\n","").replace("\t", " ") + "\n" | |
return result | |
inputs = open('./list.txt', 'r', encoding='UTF8') | |
result = '' | |
for line in inputs: | |
result += call(line.strip()) | |
inputs.close() | |
outputs = open('./output.txt', 'w', encoding='UTF8') | |
outputs.write(result) | |
outputs.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment