Guest User

Untitled

a guest
Nov 5th, 2020
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. import requests
  2. from bs4 import BeautifulSoup
  3.  
  4. s = requests.session()
  5.  
  6. validation_url = 'https://bankrot.fedresurs.ru/DebtorsSearch.aspx'
  7.  
  8. form_response = s.post(validation_url)
  9.  
  10. soup = BeautifulSoup(form_response.content, 'html.parser')
  11. viewstate = soup.find('input', id='__VIEWSTATE').get('value')
  12. viewgenerator = soup.find('input', id='__VIEWSTATEGENERATOR').get('value')
  13. previouspage = soup.find('input', id='__PREVIOUSPAGE').get('value')
  14. # print(previouspage)
  15.  
  16.  
  17. item_request_body = {
  18. '__EVENTTARGET': "",
  19. '__EVENTARGUMENT': "",
  20. '__VIEWSTATE': viewstate,
  21. '__VIEWSTATEGENERATOR': viewgenerator,
  22. '__PREVIOUSPAGE': '',
  23. 'ctl00$PrivateOffice1$tbLogin': "",
  24. 'ctl00$PrivateOffice1$tbPassword': "",
  25. 'ctl00$PrivateOffice1$cbRememberMe': "on",
  26. 'ctl00$PrivateOffice1$tbEmailForPassword': "",
  27. 'ctl00_PrivateOffice1_RadToolTip1_ClientState': "",
  28. 'ctl00$DebtorSearch1$inputDebtor': "поиск",
  29. 'ctl00$cphBody$rblDebtorType': "Persons",
  30. 'ctl00$cphBody$tbOrgName': "",
  31. 'ctl00$cphBody$tbOrgAddress': "",
  32. 'ctl00$cphBody$ucOrgRegionList$ddlBoundList': "",
  33. 'ctl00$cphBody$ucOrgCategoryList$ddlBoundList': "",
  34. 'ctl00$cphBody$OrganizationCode1$CodeTextBox': "",
  35. 'ctl00$cphBody$tbPrsLastName': "Иванов",
  36. 'ctl00$cphBody$tbPrsFirstName': "Иван",
  37. 'ctl00$cphBody$tbPrsMiddleName': "",
  38. 'ctl00$cphBody$tbPrsAddress': "",
  39. 'ctl00$cphBody$ucPrsRegionList$ddlBoundList': "",
  40. 'ctl00$cphBody$ucPrsCategoryList$ddlBoundList': "",
  41. 'ctl00$cphBody$PersonCode1$CodeTextBox': "",
  42. 'ctl00$cphBody$btnSearch.x': "48",
  43. 'ctl00$cphBody$btnSearch.y': "14"
  44. }
  45. response = s.post(url=validation_url, data=item_request_body)
  46. print(response)
  47. print(form_response.url)
  48. print(response.text)
Add Comment
Please, Sign In to add comment