Ошибка в модуле requestium (selenium)

Пожалуйста помогите решить проблему

Есть код:

import colorama
from colorama import Fore
from requestium import Session

colorama.init(autoreset=True)

user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
}

s = Session(webdriver_path='C:/Users/rednik/Desktop/python/projects/chromedriver.exe',
            browser='chrome',
            default_timeout=15,
            webdriver_options={'arguments': ['headless']})

print('[' + Fore.RED + '+' + Fore.RESET + ']' + 'Sending request')
r = s.get('https://hh.ru/login', headers=headers)

print('[' + Fore.RED + '+' + Fore.RESET + ']' + 'Got ' + Fore.CYAN + str(r.status_code) + Fore.RESET + ' status code, continuing')



s.headers.update({'Referer': 'https://hh.ru/login'})
s.headers.update({'User-Agent': user_agent})
_xsrf = s.cookies.get('_xsrf', domain=".hh.ru")

print('[' + Fore.RED + '+' + Fore.RESET + ']' + 'Logging in...')

post_request = s.post('https://hh.ru/login', {
    'backUrl': 'https://hh.ru/login',
    'username': '**',
    'password': '**',
    '_xsrf': _xsrf,
    'remember': 'yes',
})


print('[' + Fore.RED + '+' + Fore.RESET + ']' + 'Successfully logged in!')

s.get('https://hh.ru/applicant/resumes')

s.transfer_session_cookies_to_driver()

При запуске на строке s.transfer_session_cookies_to_driver() возникает ошибка:

Traceback (most recent call last):
  File "C:\Users\rednik\Desktop\python\projects\hmmm.py", line 43, in <module>
    s.transfer_session_cookies_to_driver()
  File "C:\Users\rednik\AppData\Local\Programs\Python\Python38\lib\site-packages\requestium\requestium.py", line 113, in transfer_session_cookies_to_driver
    self.driver.ensure_add_cookie({'name': c.name, 'value': c.value, 'path': c.path,
  File "C:\Users\rednik\AppData\Local\Programs\Python\Python38\lib\site-packages\requestium\requestium.py", line 235, in ensure_add_cookie
    self.add_cookie(cookie)
  File "C:\Users\rednik\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 894, in add_cookie
    self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})
  File "C:\Users\rednik\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\rednik\AppData\Local\Programs\Python\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: invalid 'expiry'
  (Session info: headless chrome=84.0.4147.105)


Process finished with exit code 1

Пробовал написать что-то другое:

from requestium import Session

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
}
s = Session(webdriver_path='C:/Users/rednik/Desktop/python/projects/chromedriver.exe',
            browser='chrome',
            default_timeout=15,
            webdriver_options={'arguments': ['headless']})

s.get('https://google.com', headers=headers)
s.cookies.get('HSID')
s.transfer_session_cookies_to_driver()

Однако ошибка возникает только в первом примере

Погуглил, нашел это: https://stackoverflow.com/questions/56663666/how-to-fix-invalid-argument-invalid-expiry-in-selenium-when-adding-cookies

Судя по всему ошибка возникает при добавлении файлов cookie, но как ее исправить я так и не понял ):

Заранее спасибо


Ответы (0 шт):