The error is indicating that at least one of cafile, capath, or cadata must be specified when calling load_verify_locations() on the SSL context.

To fix the error, you can either provide a value for one of those arguments, or remove the call to load_verify_locations() altogether since load_default_certs() is already being called to load the default trusted certificates.

Here's an updated version of the code that removes the call to load_verify_locations():

import ssl
import requests

# The SHA fingerprint of the server's SSL certificate
sha_fingerprint = "3B5230D79A630383145B95641C7C7B0C30F30A97F2D09E79F9159A5BAD41ECF5"

# Create an SSL context with the trusted fingerprint
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_REQUIRED
ssl_context.load_default_certs()
ssl_context.verify_flags = ssl.VERIFY_PEER

# Add the trusted fingerprint to the SSL context
ssl_context.check_fingerprint(sha_fingerprint)

headers = {
    "authority": "free1-api.cveoy.top",
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9,vi;q=0.8",
    "content-type": "application/json",
    "origin": "https://www.cveoy.com",
    "referer": "https://www.cveoy.com/",
    "sec-ch-ua": '"Microsoft Edge";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "Windows",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "cross-site",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36 Edg/111.0.1661.62"
}

data = {
    "prompt": "why altman changed openai from non-profit to cap profit?\n\n"
}

urls = [
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://www.cveoy.com/live2dw/assets/mtn/idle.mtn",
    "https://free1-api.cveoy.top/v3/completions"
]

for url in urls:
    response = requests.get(url, headers=headers, data=data, stream=True, verify=False)
    response.raw.decode_content = True

print(response.text)

原文地址: https://www.cveoy.top/t/topic/bZpN 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录