Cloudflare workers cannot access python requests post


/**
 * Cloudflare Workers 入口
 */
addEventListener("fetch", (event) => {
  const { request } = event
  if (request.method === "POST") {
    // 如果是 POST 请求,则写入 JSON 数据
    return event.respondWith(WriteJSON(request))
  } else if (request.method === "GET") {
    // 如果是 GET 请求,则读取 JSON 数据
    return event.respondWith(ReadJSON(request))
  }
  else {
    // 如果不是 GET 和 POST 请求,则返回 500
    return fetch("https://http.cat/500");
  }
});

/**
 * 
 * @param {*} response 解析 JSON 数据
 * @returns 
 */
async function gatherResponse(response) {
  const { headers } = response
  const contentType = headers.get("content-type") || ""
  if (contentType.includes("application/json")) {
    return JSON.stringify(await response.json())
  }
}

/**
 * 
 * @param {*} request 请求体
 * @returns 
 */
async function ReadJSON(request) {
  const { pathname } = new URL(request.url);
  // 从 KV 数据库中读取 JSON 数据
  // 此步骤需要在 Cloudflare Workers 中绑定 KV 数据库并设置别名为 JSONBASE
  const value = await JSONBASE.get(pathname)
  if (value === null) {
    // 如果没有找到 JSON 数据,则返回 404
    return fetch("https://http.cat/404");
  }
  return new Response(value)
}

/**
 * 
 * @param {*} request 请求体
 * @returns 
 */
async function WriteJSON(request) {
  const { pathname } = new URL(request.url);
  const Body = await gatherResponse(request)
  // 将 JSON 数据写入 KV 数据库
  await JSONBASE.put(pathname, Body)
  return new Response(JSON.stringify({ Body }), {
    headers: { "Content-Type": "application/json" },
  });
}

I have bind a kv named “JSONBASE”

        url = "https://jsonbase.v2ray-tokyo.workers.dev/JSONBASE/domains"

        headers = {"Content-Type": "application/json; charset=utf-8"}

        # SOCKS proxy information
        socks_proxy = "socks5://127.0.0.1:1080"

        # Dictionary to set up proxies for the request
        proxies = {"http": socks_proxy, "https": socks_proxy}
        # data = {"hello": "world"}
        data = json.dumps(jsondata)

        response = requests.post(
            url,
            headers=headers,
            data=json.dumps(data),
            # proxies=proxies
        )

in the dashboard there is 58 requests and 57 failed ,but

Traceback (most recent call last):
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connection.py", line 174, in _new_conn
    conn = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\util\connection.py", line 95, in create_connection
    raise err
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\util\connection.py", line 85, in create_connection
    sock.connect(sa)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
                       ^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._validate_conn(conn)
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connectionpool.py", line 1042, in _validate_conn
    conn.connect()
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connection.py", line 358, in connect
    self.sock = conn = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connection.py", line 179, in _new_conn
    raise ConnectTimeoutError(
urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x000001FE3485BDD0>, 'Connection to jsonbase.v2ray-tokyo.workers.dev timed out. (connect timeout=None)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programs\miniconda\Lib\site-packages\requests\adapters.py", line 489, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='jsonbase.v2ray-tokyo.workers.dev', port=443): Max retries exceeded with url: /JSONBASE/domains (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001FE3485BDD0>, 'Connection to jsonbase.v2ray-tokyo.workers.dev timed out. (connect timeout=None)'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Download\audio-visual\product-research\stripe-backlink\da_M.py", line 381, in <module>
    response = requests.post(
               ^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\requests\api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\requests\sessions.py", line 587, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\requests\sessions.py", line 701, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Programs\miniconda\Lib\site-packages\requests\adapters.py", line 553, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='jsonbase.v2ray-tokyo.workers.dev', port=443): Max retries exceeded with url: /JSONBASE/domains (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001FE3485BDD0>, 'Connection to jsonbase.v2ray-tokyo.workers.dev timed out. (connect timeout=None)'))