-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add proxy support for urllib3 #53
Comments
FYI @fxdgear |
+1 |
It's not really practical with urllib3 because in from elastic_transport import RequestsHttpNode
from elasticsearch import Elasticsearch
class CustomHttpNode(RequestsHttpNode):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# I launched an HTTP proxy using `python dummyserver/proxy.py` from the urllib3 code base
self.session.proxies = {"https": "http://localhost:8888"}
es = Elasticsearch(
"https://localhost:9200",
# See https://www.elastic.co/guide/en/elasticsearch/client/python-api/current/connecting.html to get those values
ssl_assert_fingerprint="725a0b3250ad15c01db1f31d81190490196038e2e51026bc9113ced2b36b0c7c",
basic_auth=("elastic", "5w6VlIJxgygvweV66epH"),
node_class=CustomHttpNode,
)
print(es.info().body, indent=2) The downside of using requests is added complexity and lack of support for full HTTPS proxies (TLS-in-TLS): psf/requests#5665. |
Currently it is possible to use
elasticsearch-py
behind a proxy by switching to therequests
library, which honors proxy variables [1].As discussed in elastic/rally#584 (review) it would be awesome to get proxy support for
urllib3
as well.[1] Related issues:
The text was updated successfully, but these errors were encountered: