Reputation: 666
I try to using request.get with '@' in params, but in output I have '%40' How I can decode this dict?
Using Python3
import requests
payload = {'OPERATION-NAME': 'findItemsByProduct','productId.@type':'ReferenceID'}
req = requests.post(url, params=payload)
print(req.url)
The output is - 'url?productId.%40type=ReferenceID'
Upvotes: 0
Views: 373
Reputation: 1465
Use "data" argument instead of params. You should also specify the header, in this case json and then convert the payload dict to json using json.dumps().
import requests
import json
payload = {'productId.@type':'ReferenceID'}
req = requests.post(url, headers={'Content-Type': 'application/JSON'}, data=json.dumps(payload))
print(req.url)
Upvotes: 1