[Python] Not table able to load html page with table using post method -...

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2024.

  1. Stack

    Stack Membro Participativo

    I want to get the data shown in HTML table in this website. Python requests and beautifulsoup are the main packages used. When I use post method with the parameters I get the HTML page with empty table. I'm not table to understand what is going on. [​IMG]

    def casestatus_name(csrf, party):

    try:
    test = url_get('https://cestat.gov.in')
    cookies = test.cookies.get_dict()
    test.raise_for_status()
    except Exception as e:
    print(e)
    sys.exit(1)

    payload = {
    'csrf_token': cookies['csrf_cookie_name'],
    'schema_type': 'bangalore',
    'app_type': 'pno',
    'token_no': party,
    'captcha_code': '111111',
    'button3': 'SEARCH'
    }

    response = requests.post("https://cestat.gov.in/casestatus", json=payload)

    soup = BeautifulSoup(response.text, 'html.parser')
    table = soup.find_all('table', id='example')
    print(response.text)
    return response

    Continue reading...

Compartilhe esta Página