I have a little problem. So I'm importing jsondata from an url to a project of mine. The Data will be stored in cache and outputed to discord. So that's because the project is running 24/7 and at the moment my Data only updates when I'm restarting it. So I'm searching for a way to update the data.
In the codeblock you see how I import the data. Is there a way to include a function that updates the "data"?
It wouldn't be a problem if I loose the old data, when I'm importing the new one.
The Project should work in Python 3.7 and 3.8
I can't use time.sleep in a normal function, because it sleeps the whole discord bot
from urllib import request
response = urllib.request.urlopen(url)
data = json.loads(response.read())```