I want to send some strings in a list in a POST call. eg:
www.example.com/?post_data = A list of strings
The python code receives the data as a single string (Instead of a list of strings). How do I post it as a list of strings?
There's no such thing as a "list of strings" in a URL (or in practically anything in HTTP - if you specify multiple values for the same header, they come out as a single delimited value in most web app frameworks IME). It's just a single string. I suggest you delimit the strings in some way (e.g. comma-separated) and then parse them out again at the other end.
TRY JSON(JavaScript Object Notation) it's available in the python package. Find out here: http://docs.python.org/library/json.html
You can Encode your list to an array represented in JSON and append to the post argument. Later decode it back to list...
Are you talking about this?
post_data= ",".join( list_of_strings )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With