Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from time import time
- KAD_HEAD={
- 'Host': 'kad.arbitr.ru',
- 'Connection': 'keep-alive',
- 'Pragma': 'no-cache',
- 'Cache-Control': 'no-cache',
- 'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"',
- 'Accept':'application/json, text/javascript, */*',
- 'DNT': '1',
- 'X-Requested-With': 'XMLHttpRequest',
- 'sec-ch-ua-mobile': '?0',
- 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36',
- 'sec-ch-ua-platform': '"Windows"',
- 'Sec-Fetch-Site': 'same-origin',
- 'Sec-Fetch-Mode': 'cors',
- 'Sec-Fetch-Dest': 'empty',
- 'Referer': 'https://kad.arbitr.ru/',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Accept-Language': 'ru',
- }
- class ParserKad:
- def __init__(self, request_json=None) -> None:
- self.json_data = request_json if request_json else None
- def is_need_show_captcha(self):
- try:
- r = requests.get(
- 'https://kad.arbitr.ru/Recaptcha/IsNeedShowCaptcha?_=' +
- str(int(time() * 1000)),
- headers=KAD_HEAD,
- #proxies=self.proxies,
- #cookies=self.cookies
- )
- except Exception as e:
- return True
- print(r.text)
- try:
- return r.json()['Result']
- except Exception as e:
- return True
- def search(self, index=0):
- while index < 10:
- el = self.is_need_show_captcha()
- print('el', el)
- exit()
- c = ParserKad()
- c.search()
Add Comment
Please, Sign In to add comment