Skip to content

How to use custom python packages for android? #2300

Closed Answered by wschume
wschume asked this question in Q&A
Discussion options

You must be logged in to vote

I gave accessing a FastAPI server from Flet another try and it now worked like a charm. With the following FastAPI server:

from fastapi import FastAPI

app = FastAPI()


@app.get("/")
async def read_root():
    return {"Hello": "World"}

I was able to access the server with the following script:

import requests
import flet as ft


async def main(page: ft.Page):
    page.title = "Flet counter example"
    page.vertical_alignment = ft.MainAxisAlignment.CENTER

    my_text = ft.Text(value="START")

    async def on_click(e):
        r = requests.get("http://<ip>:<port>/")

        my_text.value = r.content.decode("utf-8")
        await page.update_async()

    await page.add_async(
        ft.R…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@wschume
Comment options

@goncaze
Comment options

@wschume
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by wschume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
3 participants