Tomy Ariswara
Tomy Ariswara

Reputation: 11

How can i get the value on the same name param/key on the url format with flask?

url that I send to flask webservice :
http://localhost:5000/bendauji?do_nomor=DOCKET/ICN/05-2017/5538&[{"nourutbenda": "0 "}, {"nourutbenda": "3 "}]

flask error respond : code 400, message Bad request syntax ('GET /bendauji?do_nomor=DOCKET/ICN/05-2017/5538&[{"nourutbenda": "0 "}, {"nourutbenda": "3 "}] HTTP/1.1')

code below in flask :

do_nomor = request.args.get('do_nomor')

nourutbenda = reguest.args ???????

I need value do_nomor and list of nourutbenda. What should I do ?

Upvotes: 0

Views: 36

Answers (1)

Raja Simon
Raja Simon

Reputation: 10305

If you sending your value in this format

http://localhost:8000/bendauji?nourutbenda=2&nourutbenda=5

then you can use getlist to get the nourutbenda

request.args.getlist('nourutbenda')

Upvotes: 1

Related Questions