Created
December 23, 2018 20:09
-
-
Save dimitriipro/eb5e733afa73a8ed768d99a288548880 to your computer and use it in GitHub Desktop.
Запрос статуса заявки ПочтаБанк API poscreditservice
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
from bs4 import BeautifulSoup | |
import urllib.request, base64, urllib.error | |
lgn = 'Login' # логин | |
psw = 'Password_123456' # пароль | |
id_credit = '86220838' # номер заявки | |
url_api = 'https://my.pochtabank.ru/dbo/poscreditservice/posLead/status/' | |
url = url_api + id_credit | |
request = urllib.request.Request(url) | |
string = '%s:%s' % (lgn,psw) | |
base64string = base64.standard_b64encode(string.encode('utf-8')) | |
request.add_header("Authorization", "Basic %s" % base64string.decode('utf-8')) | |
print(request) | |
try: | |
u = urllib.request.urlopen(request) | |
print(u.getcode()) | |
print(request.header_items()) | |
soup = BeautifulSoup(u.read(), 'html.parser') | |
print(soup.prettify()) | |
except urllib.error.HTTPError as e: | |
print(e) | |
print(e.headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment