1

For example, I have this URL

https://store.epicgames.com/es-ES/p/dead-island-2--gold-edition

@app.get("/Datos/{CI}")
async def read_CI(CI: str):
    return{"CI_Datos":CI}```

This is my curl

curl -X 'GET' \
'http://127.0.0.1:8000/Datos/%2F%2F' \
-H 'accept: application/json' 

and I want the API to be able to get that URL.

I get error 404 when I pass a URL. I understand that the problem is the /.

2
  • You need to urlencode it Commented Aug 26, 2022 at 20:27
  • If you are looking for how to pass a URL as a path parameter, please have a look at this answer. If you would instead like to pass it as a query parameter, please take a look here. Commented Aug 27, 2022 at 4:31

1 Answer 1

0

After a little research, I have a solution:


@app.get("/Datos")
async def get_url(
    url: str = None
):
    return {"url": url}


Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.