mini_buildd.net module¶
Network abstraction.
Doctest Examples:
# Server: HOPO compat syntax
>>> ServerEndpoint("0.0.0.0:1234", "http").description
'tcp:interface=0.0.0.0:port=1234'
>>> ServerEndpoint(":::8066", "http").description
'tcp6:interface=\\:\\::port=8066'
# Client: Twisted syntax
>>> ClientEndpoint("tcp:host=example.com:port=1234", protocol="http").geturl()
'http://example.com:1234'
>>> ClientEndpoint("tls:host=example.com:port=1234", protocol="http").geturl()
'https://example.com:1234'
# Client: URL syntax
>>> ce = ClientEndpoint("http://example.com:1234/")
>>> ce.description
'tcp:host=example.com:port=1234'
>>> ClientEndpoint("https://example.com:1234").description
'tls:host=example.com:port=1234'
>>> ClientEndpoint("https://example.com:1234").geturl(with_user=True, path="api", query={"a": "b", "c": "d"})
'https://example.com:1234/api?a=b&c=d'
>>> ClientEndpoint("https://foo@example.com:1234").geturl(with_user=False, path="api", query={"a": "b", "c": "d"})
'https://example.com:1234/api?a=b&c=d'
>>> ClientEndpoint("https://bar@example.com:1234").geturl(with_user=True, path="api", query={"a": "b", "c": "d"})
'https://bar@example.com:1234/api?a=b&c=d'
# Client: HOPO compat syntax
>>> ClientEndpoint("foo.example.org:1234").description
'tcp:host=foo.example.org:port=1234'
>>> ClientEndpoint("foo.example.org:1234").geturl()
'http://foo.example.org:1234'
-
class
mini_buildd.net.TwistedEndpoint(description)¶ Bases:
object-
SUPPORTED_TYPES= ['ssl', 'tls', 'tcp6', 'tcp', 'unix']¶
-
is_ssl()¶
-
-
class
mini_buildd.net.Endpoint(description, protocol)¶ Bases:
mini_buildd.net.TwistedEndpoint-
get_user()¶
-
set_user(user)¶
-
hopo()¶
-
geturl(with_user=False, path='', query=None)¶
-
-
class
mini_buildd.net.ServerEndpoint(description, protocol)¶ Bases:
mini_buildd.net.EndpointTwisted-style Network Server Endpoint.
See: https://twistedmatrix.com/documents/current/core/howto/endpoints.html#servers
Notation Examples:
'tcp6:port=8066' : Unencrypted, bind on all interfaces. 'ssl:port=8066:privateKey=KEY_PATH:certKey=CERT_PATH': Encrypted, bind on all interfaces. 'tcp6:interface=localhost:port=8066' : Unencrypted, bind on localhost only. 'localhost:8066' : Compatibility host:port syntax (don't use -- might eventually go away).
-
get_certificate()¶
-
-
class
mini_buildd.net.ClientEndpoint(description, protocol='http')¶ Bases:
mini_buildd.net.EndpointTwisted-style Network Client Endpoint.
See: https://twistedmatrix.com/documents/current/core/howto/endpoints.html#clients
Notation Examples:
'tcp:host=localhost:port=8066': Connect to localhost, unencrypted. 'tls:host=localhost:port=8066': Connect to localhost, encrypted. 'http://localhost:8066' : Extra URL-style syntax (prefer twisted-style in saved configs, though). 'localhost:8066' : Compatibility host:port syntax (don't use -- might eventually go away).
-
get_certificate()¶
-
login(password)¶
-
logout()¶
-
logged_in()¶
-
urlopen(url)¶
-
http_connect()¶
-
-
mini_buildd.net.detect_apt_cacher_ng(url='http://localhost:3142')¶ Little heuristic helper for the “local archives” wizard.