I have here a simple app that displays the current bitcoin price:
import kivy
from kivy.app import App
from kivy.uix.label import Label
import requests
import time
class MyApp(App):
def build(self):
while True:
url = requests.get("https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd").json()
price = url['bitcoin']['usd']
return Label(text="Bitcoin Price
" + str(price) + " USD", font_size=72)
time.sleep(10)
if __name__ == '__main__':
MyApp().run()
When i run this app it works, however according to the coingecko api, they update the price every 120 seconds but the price in my app never updates.
I tried to set the time to 120 seconds 10 seconds 30 seconds etc but my price doesnt update after running.
And i dont get any error when running the problem so i dont know what the issue is
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…