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
Post a Comment