zero / app.py
trinhvanhung's picture
Add fetch + static server
5bf8b9e
raw
history blame
479 Bytes
import time
import requests
def fetch_data():
while True:
try:
response = requests.get("https://stock.stoknet.org/api/vnindexdata")
if response.status_code == 200:
print("Fetched data:", response.json())
else:
print(f"Error fetching data: {response.status_code}")
except Exception as e:
print("Exception:", e)
time.sleep(10)
if __name__ == "__main__":
fetch_data()