Загрузка...

Ошибка в коде

Тема в разделе Python создана пользователем Rostil 12 окт 2019. 163 просмотра

Загрузка...
  1. Rostil
    Rostil Автор темы 12 окт 2019 Дай личный! 503 12 ноя 2018
    Код

    import requests
    name = 'Roman'
    password = '1221121'
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; rv:69.0) Gecko/20100101 Firefox/69.0'}
    r = requests.session()
    html = r.get('https://www.pvpro.com/pvpro/account/choose', headers=headers)
    html2 = str(html.content)
    hml = html2.split('meta name')
    html3 = hml[4].replace('"_csrf" content="', '')
    html4 = html3.replace('"/>\\n', '')
    csrfbeta = html4.replace('=', '')
    csrfbeta = csrfbeta.replace('<', '')
    csrf = csrfbeta.replace(' ', '')
    print(csrf)
    data = {'username': name, 'password': password, '_csrf': csrf}
    htmlbeta = r.get('https://www.pvpro.com/pvpro/account/choose', headers=headers, data=data)
    htmlbeta = str(htmlbeta.content)
    print(htmlbeta)
    if 'Login Failed' in htmlbeta:
    print('Fail')
    else:
    print('Good')
    Сперва я открываю сесию, потом парсю csrf токен, и отправляю логин + пас с токеном на сайт, и на выходе ошибка
    b'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//
    org/TR/html4/loose.dtd">\n<HTML><HEAD><META HTTP-EQUIV="Conte
    ext/html; charset=iso-8859-1">\n<TITLE>ERROR: The request cou
    </TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request
    ied.</H2>\n<HR noshade size="1px">\nBad request.\nWe can\'t c
    r for this app or website at this time. There might be too mu
    figuration error. Try again later, or contact the app or webs
    ar="all">\nIf you provide content to customers through CloudF
    steps to troubleshoot and help prevent this error by reviewin
    cumentation.\n<BR clear="all">\n<HR noshade size="1px">\n<PRE
    udfront (CloudFront)\nRequest ID: Zzl_8qIxphDBN8o30j1GDWXvgy8
    _endl97A==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>'
     
  2. Rostil
    Rostil Автор темы 12 окт 2019 Дай личный! 503 12 ноя 2018
    помоги пофиксить ее плз
     
  3. Носорог
    Носорог 12 окт 2019 2285 22 апр 2019
    Rostil, белый фон?
     
  4. Eto_ne_sol
    Eto_ne_sol 12 окт 2019 Заблокирован(а) 0 12 окт 2019
    Rostil, ну не бесплатно
     
  5. Rostil
    Rostil Автор темы 12 окт 2019 Дай личный! 503 12 ноя 2018
  6. Носорог
    Носорог 12 окт 2019 2285 22 апр 2019
    Rostil, когда открываешь
     
  7. Rostil
    Rostil Автор темы 12 окт 2019 Дай личный! 503 12 ноя 2018
  8. oriole
    oriole 12 окт 2019 был(а) давно
    там защита стоит, наверное
     
  9. Rostil
    Rostil Автор темы 12 окт 2019 Дай личный! 503 12 ноя 2018
    Я вместо post, get написал ппц
    --- Сообщение объединено с предыдущим 12 окт 2019
    Блин, js не даетъ
     
Top