Skip to content

Capturing web client info: IP and user agent#1302

Merged
FeodorFitsner merged 1 commit into
mainfrom
client-info
Apr 17, 2023
Merged

Capturing web client info: IP and user agent#1302
FeodorFitsner merged 1 commit into
mainfrom
client-info

Conversation

@FeodorFitsner

@FeodorFitsner FeodorFitsner commented Apr 17, 2023

Copy link
Copy Markdown
Contributor

New page properties: client_ip and client_user_agent. Close #1053

Usage example:

import flet as ft

def main(page: ft.Page):

    page.add(
        ft.Text(f"Client IP: {page.client_ip}"),
        ft.Text(f"Client user agent: {page.client_user_agent}"),
    )

ft.app(target=main, port=8550, view=ft.WEB_BROWSER)

New `page` properties: `client_ip` and `client_user_agent`.
Close #1053
@FeodorFitsner
FeodorFitsner merged commit 981b7b0 into main Apr 17, 2023
@FeodorFitsner
FeodorFitsner deleted the client-info branch April 17, 2023 18:04
@tokyohandsome

Copy link
Copy Markdown

How can we get those properties from a web app (flet build web)?

@ndonkoHenri

Copy link
Copy Markdown
Contributor

It is because you the result of Flet build web is a static website.
In this state you can read neither the ip nor the client user agent.
Your app needs to be deployed as a web app for it to work but not as a static app.

zrr1999 pushed a commit to zrr1999/flet that referenced this pull request Jul 17, 2024
New `page` properties: `client_ip` and `client_user_agent`.
Close flet-dev#1053
@Hazelmeow

Copy link
Copy Markdown

It seems that there is a problem on IPv6... (#3999 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: More session info

4 participants