Fix multimodal registry and code sync scripts (#10759)

Co-authored-by: cctry <shiyang@x.ai>
This commit is contained in:
Lianmin Zheng
2025-09-22 15:36:01 -07:00
committed by GitHub
parent d4041a5eeb
commit 38c00ed7a1
7 changed files with 38 additions and 15 deletions

View File

@@ -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)