Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

323
Visualizações
path type variable in Flask API endpoint is splitting the variable value

I have an endpoint in my API like below:

from flask import Flask

app = Flask(__name__)

@app.route('/price/<path:url>/')
def Ex(url):
    return {'urlwas':url}

app.run()

The problem is that when I call the API with this http://127.0.0.1:5000/price/https://puresourceindia.in/store/index.php/?route=product/product&product_id=479

it should return this {"urlwas":"https://puresourceindia.in/store/index.php/?route=product/product&product_id=479"}

but it returns {"urlwas":"https://puresourceindia.in/store/index.php"}

I am unable to understand what is happening here, and how to tackle this situation?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have to URL encode the parameter, the call should become:

http://127.0.0.1:5000/price/https%3A%2F%2Fpuresourceindia.in%2Fstore%2Findex.php%2F%3Froute%3Dproduct%2Fproduct%26product_id%3D479

and the result then becomes the one expected:

{"urlwas":"https://puresourceindia.in/store/index.php/?route=product/product&product_id=479"}

See here how to URL encode your string: https://www.urlencoder.org/

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda