python - requests form-urlencoded data -


update:

I think I'm a bit closer now, if my data structure is data ('doseq = true) data = {' property ': [(' key ',' kylanth '), (' value ',' 512 '),' category ':' keys', 'offset': '0' 'Border': '10'}

Now I am getting what is very close, but still not quite right:

  category = keys And limit = 10 and property = ('key', 'kylanth') and property = ('value', '512') and offset = 0   

I am writing this question again I am Because, I think the problem is that I know, but still do not know how to fix.

I think the problem is related to the fact that the form data sent to me includes the farm field with the same name, that is, 'properties' it is my data structure:

 Data: {'key': 'key': 'kylanth', 'value': '512'}], 'category': 'keys', 'offset': '0', 'border': '100'}   

And when it is received by the web service, it should look like this:

  form data: attribute [0] [key]: keylamp properties [ 0] [Price]: 768 Category: Offset: 0 Boundary: 100   

I 'request' it:

  req = requests.post ('http: // server1 / ws1 / api / data / filters /', data = data)  
  category = keys and range = 100 and property = ('key', 'kylanth') and offset = 0  

Like:

  attribute [0] [key] = keypad and properties [0] [value] = 768 and category = and offset = 0 and range = 100   

Can someone advise me what I am doing.

You will not be able to get it directly from Python's standard library manual, encoding Python URLs like this Works: Change a mapping object or a sequence of two-element tuples .

There is no support for the list of explosions or the hash value as you want: You have to pre-process your data so that you can try the function like this:

 < code> def define (h, resul = none, kk = none): if there is no resul: for resul = {} (h, V, list) or isinstance (v, tuple) in h (k, v) h if i , is counted in v1 (v): (=) If none other than kk "% s [% s]"% (kk, k): (v1, resul, '% s [% d]'% (key, i) elif isinstance (v, dict): i for v.items: v1: conversion (v1, resul, '% s [% S]'% (key, i)): resul [key ] = v return resu L   

With the original data structure, it gives you:

  & gt; & Gt; & Gt; '0', 'border': '100': '' '' '' '' '' ''}} & Gt; & Gt; 'Insect': 'insect', 'border': '100', 'properties [0] [key]': 'kylanth', 'offset': '0', 'attribute [0] [value]': '512 '}   

and then it will be encoded according to your needs

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -