OpenBB-finance/OpenBB

[Bug] Missing HTTP Proxy Setting

MovisLi opened this issue · 1 comments

Describe the bug
I notice the document metioned Proxy Network in User Settings & Enviroment Variables, but I can't find this setting in source codes anywhere. So is there some thing wrong in the document or the codes?

To Reproduce

  1. Refer to other enviroment variables, I think HTTP_PROXY or HTTPS_PROXY should found in openbb_core/env.py. However it isn't.
  2. Then I check the session definition file openbb_core/utils/client.py, there is a class named ClientSession, but it don't use proxies parameter durning initialization.
  3. Then I check the request tool function amake_request, make_request in file openbb_core/provider/utils/helpers.py, it also doesn't use proxies parameter.

So, is HTTP_PROXY and HTTPS_PROXY deprecated?

Screenshots

Document
image

openbb_core/env.py File
image

openbb_core/utils/client.py
image

openbb_core/provider/utils/helpers.py
image

Desktop (please complete the following information):

  • OS: Windows 11
  • Python version 3.11.9

Additional context
Thanks for answering my problem.

Hi,

Thanks for the report. The issue arises from using both requests and aiohttp, and only requests reads the environment variables by default. I have added the necessary setting in the aiohttp.ClientSession initialization (#6640) to allow for the same behavior from all three HTTP IO helper functions - make_request, amake_request, and amake_requests - which should cover all HTTP requests throughout the library.

Note that the vast majority of requests will be HTTPS and not HTTP, but for full coverage define both addresses.

See: https://docs.python.org/3/library/urllib.request.html#urllib.request.getproxies