Skip to content

Get The (Actual) Current URL #4000

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

You must be logged in to vote

Hi @PoshoDev,

Luckily you can access the current FastAPI request object which contains the requested URL:

@ui.page("/{user}/{pet}")
def page_home(user: str, pet: str, source: str = None):
    print(ui.context.client.request.url)

Apart from the complete URL it contains useful properties like base_url, path_params, query_params etc.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PoshoDev
Comment options

PoshoDev Nov 17, 2024
Author Sponsor

Answer selected by PoshoDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants