Created
August 6, 2014 11:11
-
-
Save ffoxin/d9ce372df92debcf55d0 to your computer and use it in GitHub Desktop.
mvd.gov.by
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
__author__ = 'Vital Kolas' | |
__date__ = '2014-08-06' | |
import json | |
import urllib.request | |
if __name__ == '__main__': | |
json_data = { | |
'GuidControl': 2091, | |
'Param1': 'Иванов Дмитрий Иванович', | |
'Param2': 'МАА', | |
'Param3': '123456' | |
} | |
post_data = json.dumps(json_data).encode('utf-8') | |
url = 'http://mvd.gov.by/Ajax.asmx/GetExt' | |
headers = {'Content-Type': 'application/json; charset=UTF-8'} | |
request = urllib.request.Request(url, post_data, headers) | |
response = urllib.request.urlopen(request) | |
response_text = response.read().decode() | |
no_penalty = '\"\\u003ch2\\u003eПо заданным критериям поиска информация не найдена\\u003c/h2\\u003e\"' | |
if response_text == no_penalty: | |
print('Ok') | |
else: | |
print('Penalty') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment