Spaces:
Sleeping
Sleeping
Update brie_agent.py
Browse files- brie_agent.py +10 -3
brie_agent.py
CHANGED
|
@@ -9,11 +9,18 @@ from urllib3.poolmanager import PoolManager
|
|
| 9 |
# --- Custom Adapter to solve the Hugging Face 'UNEXPECTED_EOF' Error ---
|
| 10 |
class TLSAdapter(HTTPAdapter):
|
| 11 |
def init_poolmanager(self, connections, maxsize, block=False):
|
| 12 |
-
#
|
| 13 |
-
# errors caused by the Hugging Face networking layer.
|
| 14 |
ctx = ssl.create_default_context()
|
|
|
|
|
|
|
| 15 |
ctx.check_hostname = False
|
| 16 |
-
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
self.poolmanager = PoolManager(
|
| 18 |
num_pools=connections,
|
| 19 |
maxsize=maxsize,
|
|
|
|
| 9 |
# --- Custom Adapter to solve the Hugging Face 'UNEXPECTED_EOF' Error ---
|
| 10 |
class TLSAdapter(HTTPAdapter):
|
| 11 |
def init_poolmanager(self, connections, maxsize, block=False):
|
| 12 |
+
# Create a context that forces TLS 1.2 and a broader cipher list
|
|
|
|
| 13 |
ctx = ssl.create_default_context()
|
| 14 |
+
|
| 15 |
+
# This tells the library to ignore the "Unexpected EOF" protocol violation
|
| 16 |
ctx.check_hostname = False
|
| 17 |
+
ctx.verify_mode = ssl.CERT_NONE
|
| 18 |
+
|
| 19 |
+
# Standardizing the security protocol
|
| 20 |
+
ctx.options |= ssl.OP_NO_SSLv2
|
| 21 |
+
ctx.options |= ssl.OP_NO_SSLv3
|
| 22 |
+
ctx.set_ciphers('DEFAULT@SECLEVEL=1') # Slightly more lenient security level
|
| 23 |
+
|
| 24 |
self.poolmanager = PoolManager(
|
| 25 |
num_pools=connections,
|
| 26 |
maxsize=maxsize,
|