MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / wrapmodule

Function wrapmodule

src/socks/__init__.py:103–113  ·  view source on GitHub ↗

wrapmodule(module) Attempts to replace a module's socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category

(module)

Source from the content-addressed store, hash-verified

101 _defaultproxy = (proxytype, addr, port, rdns, username, password)
102
103def wrapmodule(module):
104 """wrapmodule(module)
105 Attempts to replace a module's socket library with a SOCKS socket. Must set
106 a default proxy using setdefaultproxy(...) first.
107 This will only work on modules that import socket directly into the namespace;
108 most of the Python Standard Library falls into this category.
109 """
110 if _defaultproxy != None:
111 module.socket.socket = socksocket
112 else:
113 raise GeneralProxyError((4, "no proxy specified"))
114
115class socksocket(socket.socket):
116 """socksocket([family[, type[, proto]]]) -> socket object

Callers

nothing calls this directly

Calls 1

GeneralProxyErrorClass · 0.70

Tested by

no test coverage detected