We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cef606f commit 984be21Copy full SHA for 984be21
examples/docker-info-alt2.py
@@ -0,0 +1,21 @@
1
+#!/usr/bin/env python
2
+
3
+import json
4
+from requests.compat import urlparse
5
6
+from requests_unixsocket import Session, UnixAdapter
7
8
9
+def custom_urlparse(url):
10
+ parsed_url = urlparse(url)
11
+ return UnixAdapter.Settings.ParseResult(
12
+ sockpath=parsed_url.path,
13
+ reqpath=parsed_url.fragment,
14
+ )
15
16
17
+session = Session(settings=UnixAdapter.Settings(urlparse=custom_urlparse))
18
19
+r = session.get('http+unix://sock.localhost/var/run/docker.sock#/info')
20
+registry_config = r.json()['RegistryConfig']
21
+print(json.dumps(registry_config, indent=4))
0 commit comments