Last active
November 11, 2021 04:34
-
-
Save search5/ffc81d48171616508bab5d265c4c0ba2 to your computer and use it in GitHub Desktop.
경찰청 사기계좌(휴대번호) 조회 with 파이썬
This file contains hidden or 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 requests | |
from urllib import parse | |
import json | |
import re | |
headers = { | |
'Referer': 'https://cyberbureau.police.go.kr/prevention/sub7.jsp?mid=020600', | |
} | |
fieldType = 'A' # 휴대폰은 H, A는 계좌번호 | |
keyword = '검색대상 번호' | |
accessType = '3' | |
query = { | |
'fieldType' : fieldType, | |
'keyword' : keyword, | |
'accessType' : accessType, | |
'callback': '' | |
} | |
parse.urlencode(query, encoding='UTF-8', doseq=True) | |
cybercopUrl = "https://net-durumi.cyber.go.kr/getMessage.do" | |
req = requests.post(cybercopUrl, data=query, headers=headers) | |
result = json.loads(req.text[1:-1]) | |
result = re.sub(r'(<[a-z]*>)', r'', result['message']) | |
result = re.sub(r'(</[a-z]*>)', r'', result) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment