-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[py] Allows setting Remote webdriver ca_certs through REQUESTS_CA_BUNDLE env variable. #11957
Conversation
certifi ignores it, and I need it since we run a local grid exposed by https.
It might need to support |
I'm working on a config class for these. Can we integrate what you need into this? #12033 |
It seems the reason why this fix is needed because some distros would override how |
Cool config class! Still we prefer this because it is easier with already existing tests without changing anything. The variable is consistent with requests and allow us to prevent the issue certifi. We are migrating to selenium grid behind https and we run containers. Adding just an environment variable would be least invassive solution to our legacy code. We haven't tried SSL_CERT_FILE, but anyhow it uses certifi return value. |
It is not good practice to set the internal state of a library class with an environment variable. It's somewhat similar to Java's (over-)use of System Properties in Service classes, but those are mostly there for use by the grid. It is better practice to access configuration values/environment variables outside of the library in code you control and pass them in:
(note that this syntax is what would work once #12033 is merged) The |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## trunk #11957 +/- ##
==========================================
- Coverage 57.25% 56.92% -0.33%
==========================================
Files 86 86
Lines 5488 5423 -65
Branches 228 193 -35
==========================================
- Hits 3142 3087 -55
- Misses 2118 2143 +25
+ Partials 228 193 -35
☔ View full report in Codecov by Sentry. |
Buenas!
yes, I understand, but since Selenium is overriding the use of requests env variable, I would like it to act the same way requests does. Specially because in case you need to check some stuff with remote rest APIs.
I don't know if this is so In containers environments. Additionally, you have HTTPS_PROXY env variable, which is used extensively by many libraries in many languages.
Something similar to the previous code could be achieved by (yes, it's class method but shouldn't be many certificate_bundles): certificate_path = os.getenv("REQUESTS_CA_BUNDLE")
RemoteConnection.set_certificate_bundle_path(certificate_path)
I wouldn't add an environment variable that duplicates the responsibility of REQUESTS_CA_BUNDLE. |
Oh this *is an env already being used elsewhere. That's different. I still don't love using ENV this way, but if other libraries support this particular ENV, then I'm ok with us doing it as well. |
I understand it may seem untidy, but it's a common practice environments and very useful on containers envs. BTW, we are not adding an extra one, but preventing the occlusion of a common one our use of the requests library. May I ask you a favor. I'm getting an error on the linter with the comments. How can I reproduced it locally and fix it? Thank you very much in advance! |
@diemol what did you do to get the linter working locally? Or doesn't work locally for me, either. @AutomatedTester do you know if there is an easy bazel rule we can drop in and use for this? |
I installed the tox version configured in the GitHub workflow and then ran the same command from the step. |
I did all of that, and made sure the versions all matched and it still didn't give me what I expected. I guess I'm on a different laptop now and should try again. |
@miguelius sorry for not keeping on top of this one. thank you! |
Thank you, guys! This great for my team!! Bientôt! |
Description
Allows to configure Remote Webdriver ca_cert through a common environment variable used to that kind of config: REQUESTS_CA_BUNDLE
Motivation and Context
We have a Selenium many grids exposed by https with their own CA and we need to override _ca_bundle through environment variable. Currently, it takes it from certifi.where(), but this method ignores REQUESTS_CA_BUNDLE.
Types of changes
Checklist