Spaces:
Sleeping
Sleeping
Update run_app.py
Browse files- run_app.py +9 -0
run_app.py
CHANGED
|
@@ -21,8 +21,17 @@ from g4f.client import AsyncClient
|
|
| 21 |
from g4f.typing import Messages
|
| 22 |
from g4f.cookies import read_cookie_files
|
| 23 |
|
|
|
|
| 24 |
import ssl
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
orig_sslsocket_init = ssl.SSLSocket.__init__
|
| 27 |
def new_sslsocket_init(self, *args, **kwargs):
|
| 28 |
kwargs['cert_reqs'] = ssl.CERT_NONE
|
|
|
|
| 21 |
from g4f.typing import Messages
|
| 22 |
from g4f.cookies import read_cookie_files
|
| 23 |
|
| 24 |
+
import aiohttp
|
| 25 |
import ssl
|
| 26 |
|
| 27 |
+
# Crear un contexto SSL personalizado que no verifica certificados
|
| 28 |
+
ssl_ctx = ssl.create_default_context()
|
| 29 |
+
ssl_ctx.check_hostname = False
|
| 30 |
+
ssl_ctx.verify_mode = ssl.CERT_NONE
|
| 31 |
+
|
| 32 |
+
# Monkey patch para modificar el comportamiento de aiohttp
|
| 33 |
+
aiohttp.TCPConnector._ssl_context = ssl_ctx
|
| 34 |
+
|
| 35 |
orig_sslsocket_init = ssl.SSLSocket.__init__
|
| 36 |
def new_sslsocket_init(self, *args, **kwargs):
|
| 37 |
kwargs['cert_reqs'] = ssl.CERT_NONE
|