Use %20 instead of + for space in python query parameters -


I've written the following Python script using Python requests:

  import request payload = {'Key1': 'value1', 'key2': 'value2'} header = {'content-type': 'app / jason; Charset = UTF-8 '} R = Requests. "(" Http: //example.com/service ", params = payload, headers = headers, auth = (" admin "," password "))   

Request: / service? Key1 = value ++ 1 & key2 = value + 2

However, the server expects ... value% 20% 201 & amp; ...

I have read that as a placeholder for space + content type is part of the application / x-www-form-urlx, but clearly I requested the application / jason .

In the query parameter of any dragon requests How to use% 20 as a place?

Try.

  import urllib urllib.urlencode (parameter)   



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -