Spaces:
Sleeping
Sleeping
File size: 479 Bytes
5bf8b9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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()
|