Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I know it's very simple but i'm trying since an hour to get the url parameters:

www.domain.com/?f=x**2

How do i get x**2 from the url in a Flask view?

share|improve this question
    
Regarding that question you just deleted: You could use a regular expression, and replace ([a-z]|\d+)(?=[a-z]|\d+) with \1*. That would work for variables. –  minitech Dec 26 '12 at 15:45

1 Answer 1

up vote 16 down vote accepted

I believe that you can retrieve query string variables using

request.args.get('myParam')

or

request.args['myParam']

Where myParam is the variable in the query string you're trying to receive.

share|improve this answer
2  
and if you want to set a default value... request.args.get('myParam', 'myDefaultValue') –  seafangs Aug 22 at 21:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.