Fix multimodal registry and code sync scripts (#10759)
Co-authored-by: cctry <shiyang@x.ai>
This commit is contained in:
@@ -8,6 +8,7 @@ import logging
|
||||
import os
|
||||
import random
|
||||
import socket
|
||||
import ssl
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
@@ -158,7 +159,15 @@ def http_request(
|
||||
data = bytes(dumps(json), encoding="utf-8")
|
||||
|
||||
try:
|
||||
resp = urllib.request.urlopen(req, data=data, cafile=verify)
|
||||
if sys.version_info >= (3, 13):
|
||||
# Python 3.13+: Use SSL context (cafile removed)
|
||||
if verify and isinstance(verify, str):
|
||||
context = ssl.create_default_context(cafile=verify)
|
||||
else:
|
||||
context = ssl.create_default_context()
|
||||
resp = urllib.request.urlopen(req, data=data, context=context)
|
||||
else:
|
||||
resp = urllib.request.urlopen(req, data=data, cafile=verify)
|
||||
return HttpResponse(resp)
|
||||
except urllib.error.HTTPError as e:
|
||||
return HttpResponse(e)
|
||||
|
||||
Reference in New Issue
Block a user