guri guri - 4 months ago 28
HTTP Question

How to configure Flask to consider URL as one argument passed through CURL command

import Flask
app.route('/urlinfo/1/<URL>', methods=['GET'])
def search(URL):
print URL

I am making curl command to to test it


Since URL include '//' Flask consider it as a second argument and throw an error.

1.How to pass whole URL as an one argument in

curl command?

2.How to check that Enter URL is valid?


Change your decorator to this:

@app.route('/urlinfo/1/<path:URL>', methods=['GET'])

By adding path to the URL arguments, slashes should be accepted.