Hello, everyone!
I’m using requests module to request a certain value from a website api that varies over time, like a cryptocurrency price for example. So i’m using st.write(price) and i would like to replace this value instead of printing the price in a new line.
For now i’m using this code:
while True:
# Get request
resp = request.post(url, headers=headers, data=data)
# Transform in a json file
newjson = resp.json()
# Get the value (price is a str)
price = newjson[‘rows’][0][‘price’]
# Print the price
st.write('The price is: {}".format(price))
I need the script to print the new value in a little time like every 1 second, 2 seconds max.
Thank you!