MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / http_post

Method http_post

test/test_encryption.py:3031–3050  ·  view source on GitHub ↗
(self, path, data=None)

Source from the content-addressed store, hash-verified

3029 )
3030
3031 def http_post(self, path, data=None):
3032 # Note, the connection to the mock server needs to be closed after
3033 # each request because the server is single threaded.
3034 ctx = ssl.create_default_context(cafile=CA_PEM)
3035 ctx.load_cert_chain(CLIENT_PEM)
3036 ctx.check_hostname = False
3037 ctx.verify_mode = ssl.CERT_NONE
3038 conn = http.client.HTTPSConnection("127.0.0.1:9003", context=ctx)
3039 try:
3040 if data is not None:
3041 headers = {"Content-type": "application/json"}
3042 body = json.dumps(data)
3043 else:
3044 headers = {}
3045 body = None
3046 conn.request("POST", path, body, headers)
3047 res = conn.getresponse()
3048 res.read()
3049 finally:
3050 conn.close()
3051
3052 def _test(self, provider, master_key):
3053 self.http_post("/reset")

Callers 1

_testMethod · 0.95

Calls 3

load_cert_chainMethod · 0.80
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected