[Python] Simple get requests taking minutes in streamlit app

Discussão em 'Python' iniciado por Stack, Janeiro 24, 2025.

  1. Stack

    Stack Membro Participativo

    import requests

    url = "https://jsonplaceholder.typicode.com/posts"
    print("Getting response")
    response = requests.get(url)

    if response.status_code == 200:
    print("Response OK!")
    print(response.json()) # Print the returned JSON data
    else:
    print(f"Failed to fetch data. Status code: {response.status_code}")



    When I run this script as streamlit run app.py, the response comes back after 10 minutes and I don't see any output. Whereas python app.py finished in milliseconds. I am running it locally

    Can somebody suggest how to use API calls within a Streamlit app?

    Continue reading...

Compartilhe esta Página