[Python] Wait for screen to load requests

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to get data from a website that has a loading screen before showing the content I want. However, unlike a blank loading screen, the requests library interprets this screen as if it were already the loaded content and returns it. I tried iterating over the section to get an 'input' tag object that only appears after loading, but the loop goes infinite, as if it reloads the loading screen, while it should continue loading and return the current stage:

    import requests
    from bs4 import BeautifulSoup as bs

    url = 'URL...'

    def response():
    global url

    soup = bs('')
    s = requests.session()

    while not soup.find_all('input'):
    r = s.get(url)

    soup = bs(r.text, 'html.parser')

    return soup

    soup = response()


    How do I get the expected content?

    Continue reading...

Compartilhe esta Página