MCPcopy
hub / github.com/docker/docker-py / _url

Method _url

docker/api/client.py:256–270  ·  view source on GitHub ↗
(self, pathfmt, *args, **kwargs)

Source from the content-addressed store, hash-verified

254 return self.delete(url, **self._set_request_timeout(kwargs))
255
256 def _url(self, pathfmt, *args, **kwargs):
257 for arg in args:
258 if not isinstance(arg, str):
259 raise ValueError(
260 f'Expected a string but found {arg} ({type(arg)}) instead'
261 )
262
263 quote_f = partial(urllib.parse.quote, safe="/:")
264 args = map(quote_f, args)
265
266 formatted_path = pathfmt.format(*args)
267 if kwargs.get('versioned_api', True):
268 return f'{self.base_url}/v{self._version}{formatted_path}'
269 else:
270 return f'{self.base_url}{formatted_path}'
271
272 def _raise_for_status(self, response):
273 """Raises stored :class:`APIError`, if one occurred."""

Callers 15

_attach_websocketMethod · 0.95
test_url_no_resourceMethod · 0.80
requestMethod · 0.80
create_configMethod · 0.80
inspect_configMethod · 0.80
remove_configMethod · 0.80
configsMethod · 0.80
networksMethod · 0.80
create_networkMethod · 0.80

Calls 1

getMethod · 0.45

Tested by 5

test_url_no_resourceMethod · 0.64
requestMethod · 0.64