Replies: 2 comments
-
You can simply utilize any python library. I suggest httpx because of it's async-capbailities. See https://github.com/zauberzeug/nicegui/wiki/FAQs#why-is-my-long-running-function-blocking-ui-updates |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is example code: @ui.page("/ana/a")
def ana_page():
file = "data/a.json"
if not os.path.exists(file):
ana_messages = file_not_found_error(file)
else:
with open(file, 'r') as f:
ana_messages = json.load(f)
number = random.randint(0, len(ana_messages) - 1)
print(number)
ana_messages = ana_messages[number]
id = ana_messages["id"]
msg = ana_messages["msg"]
author = ana_messages["author"]
time = ana_messages["time"]
with ui.card().classes("absolute-center"):
with ui.row():
ui.badge("id")
ui.label(id)
with ui.row():
ui.badge("语录")
ui.label(msg)
with ui.row():
ui.badge("作者")
ui.label(author)
with ui.row():
ui.badge("时间")
ui.label(time) How can I get data on ana_messages? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I hope to use another Python program to get JSON data callback for page functions through URL, for example:
What can i do?
Beta Was this translation helpful? Give feedback.
All reactions