I want to use urllib3
library for making POST request over requests
library since it has connection pooling and retries etc. But I couldn't
find any substitute of following POST
request.
import requests
result = requests.post("http://myhost:8000/api/v1/edges", json={'node_id1':"VLTTKeV-ixhcGgq53", 'node_id2':"VLTTKeV-ixhcGgq51", 'type': 1 })
This is working fine with requests
library but I couldn't convert this into urllib3
request.
I tried
import json
import urllib3
urllib3.PoolManager().request("POST","http://myhost:8000/api/v1/edges", body=json.dumps(dict(json={'node_id1':"VLTTKeV-ixhcGgq53", 'node_id2':"VLTTKeV-ixhcGgq51", 'type': 1 })))
Problem is with passing raw json data with json
as key in POST
request.