guri guri - 1 year ago 72
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?

Answer Source

Change your decorator to this:

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download