kokokoasd's picture
download
raw
867 Bytes
import os
import ssl
TARGETS = {
"www.facebook.com",
"facebook.com",
"m.facebook.com",
"graph.facebook.com",
}
_orig_wrap_socket = ssl.SSLContext.wrap_socket
def _patched_wrap_socket(self, *args, **kwargs):
server_hostname = kwargs.get("server_hostname")
if server_hostname in TARGETS:
# Work around network SNI filtering for selected Facebook hosts.
kwargs["server_hostname"] = None
try:
self.check_hostname = False
except Exception:
pass
try:
self.verify_mode = ssl.CERT_NONE
except Exception:
pass
if os.environ.get("FB_WRAP_DEBUG") == "1":
print(f"[fb-wrap-python] disabled SNI for {server_hostname}", flush=True)
return _orig_wrap_socket(self, *args, **kwargs)
ssl.SSLContext.wrap_socket = _patched_wrap_socket

Xet Storage Details

Size:
867 Bytes
·
Xet hash:
6f2b43d3d0c14ef3034f5d022ca612a660969c542bb97a50cd96129cd7a72975

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.