Answer the question
In order to leave comments, you need to log in
Flask and problems with '&' character in URL?
There is a url:
site.com/?foo=bar& Request.url
turns out to be site.com/?foo=bar Turns
out to be foo=bar in
request.query_string '&' from 'bar&' is lost. Question: how to get a GET parameter with & at the end
Answer the question
In order to leave comments, you need to log in
In general, this is of course not correct, but it can be done like this:
@app.route('/foo')
def foo():
raw = str(request)
return raw
@app.route('/foo')
def foo():
raw = str(request)
print(raw)
p = re.compile(r"""(\?|\&)([^=]+)\=(?P<val>([^']+))""")
r = p.search(raw)
return r.group("val")
"http://site.com/?"+urllib.quote_plus("foo=bar&")
urllib.unquote_plus("string%26%25%3A")
and why actually problems?
in the specified variant everything worked correctly. because the symbol
&is intended to point to the next parameter. which you don't have. hence it simply ignored it as unnecessary in this context.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question