Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][FR] Impossible to specify SSL certification #6939

Open
LucaMingarelli opened this issue Nov 7, 2024 · 6 comments · May be fixed by #6976
Open

[BUG][FR] Impossible to specify SSL certification #6939

LucaMingarelli opened this issue Nov 7, 2024 · 6 comments · May be fixed by #6976
Labels
enhancement Enhancement

Comments

@LucaMingarelli
Copy link

What's the problem of not having this feature?
This feature is essential as its lack prevents using openbb at all when SSL certification is required to connect to the network.

Solution
The library should have some way to specify the path to the SSL certificate. When using requests this would be for example set in the verify attribute of the session. Therefore I would see two options:

  • Exposing explicitely the session from request instantiated (e.g. I see it in yfinance/data.py, line 73). This would meen having the session exposed as an attribute for example obb.session, so that its attributes can be modified.
  • Specifying a variable in the .env file which will then picked up when creating a request.Session() in a similar manner to what is done for proxies.
@deeleeramone
Copy link
Contributor

Hi there,

You can install this package, https://pypi.org/project/pip-system-certs/, that will force Python to use the system trust store instead of from the certifi package.

Alternatively, the requests library allows you to define environment variables:

REQUESTS_CA_BUNDLE

@deeleeramone
Copy link
Contributor

deeleeramone commented Dec 1, 2024

@LucaMingarelli, PR #6976 should resolve the issue and provide a way to define these values across all HTTP requests submitted by OpenBB functions, globally. Please try it out, if you have the opportunity.

@LucaMingarelli
Copy link
Author

The library should have some way to specify the path to the SSL certificate. When using requests this would be for example set in the verify attribute of the session. Therefore I would see two options:

Yes, although this may also interfere with settings from other libraries.

@LucaMingarelli
Copy link
Author

@LucaMingarelli, PR #6976 should resolve the issue and provide a way to define these values across all HTTP requests submitted by OpenBB functions, globally. Please try it out, if you have the opportunity.

This looks great! I'll try to test it asap

@piiq
Copy link
Contributor

piiq commented Dec 5, 2024

@LucaMingarelli hi 👋 thanks for this issue
Can you please give me an example where you would require 2 libraries in the same application/environment require different certificates for the requests library at the same time? I'm just trying to understand the use case here

@LucaMingarelli
Copy link
Author

Hi @piiq

I am not fully sure on the more technical details, but internally at work we have two different data sources: one which requires no certificate is specified, the other requiring a specific certificate. Setting the env variable would mean being able to connect to only one of the two sources. For this reason we pass explicitly the path to certificates when instantiating two different sessions.

I hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants