Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda