Skip to content

Instantly share code, notes, and snippets.

@dimitriipro
Created December 23, 2018 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimitriipro/eb5e733afa73a8ed768d99a288548880 to your computer and use it in GitHub Desktop.
Save dimitriipro/eb5e733afa73a8ed768d99a288548880 to your computer and use it in GitHub Desktop.
Запрос статуса заявки ПочтаБанк API poscreditservice
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