MichielvanBeers / Flow.Launcher.Plugin.ChatGPT

MIT License
37 stars 5 forks source link

Plugin connectivity issues #49

Closed Attack825 closed 9 months ago

Attack825 commented 9 months ago
PROXIES = {
    "http": os.environ.get("HTTP_PROXY", ""),
    "https": os.environ.get("HTTPS_PROXY", ""),
}
# response = requests.request(
#     "POST", url, headers=headers, data=data, proxies=PROXIES
# )
response = requests.request(
    "POST", url, headers=headers, data=data
)

"I initially experienced connection timeouts when using a plugin, which rendered the plugin unusable. When I tried connecting to the OpenAI API for the first time, I made some modifications and the plugin started working. However, I don't fully understand the underlying principle behind this. I am located in mainland China."

MichielvanBeers commented 9 months ago

Hi, @Attack825,

The lines of code that were changed, are responsible for looking up Environment variables in your system called HTTP_PROXY and HTTPS_PROXY. If it cannot find them, it will leave them empty (that is where the empty double quotes "") are for.

I guess that these values get somehow field on your machine. You can see them by searching for Environment Variables in Windows Start > Search. However, leaving the code like this, should also be fine (do note that these changes are most likely overwritten when updating the Plugin)

Have a great day!