MCPcopy Create free account
hub / github.com/docker/docker-py / _post_json

Method _post_json

docker/api/client.py:289–303  ·  view source on GitHub ↗
(self, url, data, **kwargs)

Source from the content-addressed store, hash-verified

287 return response.text
288
289 def _post_json(self, url, data, **kwargs):
290 # Go <1.1 can't unserialize null to a string
291 # so we do this disgusting thing here.
292 data2 = {}
293 if data is not None and isinstance(data, dict):
294 for k, v in iter(data.items()):
295 if v is not None:
296 data2[k] = v
297 elif data is not None:
298 data2 = data
299
300 if 'headers' not in kwargs:
301 kwargs['headers'] = {}
302 kwargs['headers']['Content-Type'] = 'application/json'
303 return self._post(url, data=json.dumps(data2), **kwargs)
304
305 def _attach_params(self, override=None):
306 return override or {

Callers 15

create_configMethod · 0.80
create_networkMethod · 0.80
pushMethod · 0.80
loginMethod · 0.80
create_secretMethod · 0.80
init_swarmMethod · 0.80
join_swarmMethod · 0.80
unlock_swarmMethod · 0.80
update_nodeMethod · 0.80
update_swarmMethod · 0.80

Calls 1

_postMethod · 0.95

Tested by

no test coverage detected