samedi 9 janvier 2016

How to handle special characters in URL with Flask

I am using Flask to develop a mini API backend, I have following URL:

@app.route('/v1.0/post/check/<path:url>')
def check(url):
    print url
    //do some works

A sample API call looks like: /v1.0/post/check/http://ift.tt/1VV0fYP

What I expected is to get and print URL string 'http://ift.tt/1VV0fYP' in the code, but in fact, what I really get is only 'http://ift.tt/1RBMdea'

Seems Flask considers '?' and '&' as special chars and then split a URL automatically. So what I should do in order to get the URL as a whole in Flask?




Aucun commentaire:

Enregistrer un commentaire