question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Description

I was going through the Path Parameter and Query Parameters.

So far I got, We have to create a parameter for both Path Parameters & Query Parameters in our function.

My question is what if someone wants to create an API like this.

https://example.com/message/{user_id}?user_id=alif&message=hello

To create such API I have to pass two parameters with same name but which doesn’t allows in Python.

@app.get('/message/{user_id}')
async def create_message(user_id: str, user_id: str, message: str):
    ......
    ......
    return {}

Is there any way to do this or I am missing something?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ritesh-dubeycommented, Jul 7, 2022

@JarroVGIT Example usage of path parameters with alias

@app.get("/users/{id}/profile/")
def user_profile(user_id: int = Path(None, alias="id")):
    return {
        "id": user_id,
        "username": "johndoe"
    }
1reaction
JarroVGITcommented, Jun 16, 2022

Have you tried it? If so, what was the outcome? If not, please do:)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Taylor Swift - Question...? (Lyric Video) - YouTube
Listen to “ Question …?” by Taylor Swift from the album 'Midnights'.Buy/Download/Stream 'Midnights': ...
Read more >
System Of A Down - Question! (Official HD Video) - YouTube
Official HD music video for ” Question !" by System of a DownListen to System of a Down: https://SystemOfADown.lnk.to/listenYDSubscribe to the ...
Read more >
Question Definition & Meaning - Merriam-Webster
noun ; b · a subject or aspect in dispute or open for discussion : issue ; d · the specific point at...
Read more >
Question Definition & Meaning | Dictionary.com
a problem for discussion or under discussion; a matter for investigation. a matter of some uncertainty or difficulty; problem (usually followed by of):...
Read more >
Meaning of question in English - Cambridge Dictionary
a sentence or phrase used to find out information: The police asked me questions all day. Why won't you answer my question?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found