Closed Cruzxu2008 closed 9 months ago
import os
os.environ["http_proxy"] = "http://127.0.0.1:7890"
os.environ["https_proxy"] = "http://127.0.0.1:7890"
AND
pip3 uninstall urllib3
pip3 install urllib3==1.25.11
Also check whether vpn is blocked by open ai
I believe the cause of this issue is that you're in a country that is not supported by OpenAI. Unfortunately there isn't much we can do about this.
Here's a list of the countries currently supported: https://platform.openai.com/docs/supported-countries.
Please feel free to ask any more questions in the community forum! https://community.openai.com/
Describe the bug
I have successfully installed the openai-python library. When I copy the following code from README.md, I get an error when trying to run the program.
Code content:
Note: Due to relevant confidentiality requirements, I save my api-key in my local json file, and after testing, my code can normally read the api-key stored in the json file
Error content:
After repeated attempts, I found that it was because I was using a network proxy. So I tried shutting down the network agent and rerun the code. But after a long waiting period, the error was still reported.
Error content:
The connection to the host timed out or failed to connect. This is due to the fact that my country and region cannot connect to openai's server without network proxy.
I really hope this problem can be solved and I am looking forward to your reply.
To Reproduce
1.edit code code content:
Note: Due to relevant confidentiality requirements, I save my api-key in my local json file, and after testing, my code can normally read the api-key stored in the json file 2.run 3.see error
Code snippets
No response
OS
Windows11
Python version
Python 3.9.10
Library version
openai-python v0.27.6