File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ class PrometheusConnect:
3636 :param retry: (Retry) Retry adapter to retry on HTTP errors
3737 :param auth: (optional) Auth tuple to enable Basic/Digest/Custom HTTP Auth. See python
3838 requests library auth parameter for further explanation.
39+ :param proxy: (Optional) Proxies dictonary to enable connection through proxy.
40+ Example: {"http_proxy": "<ip_address/hostname:port>", "https_proxy": "<ip_address/hostname:port>"}
3941 """
4042
4143 def __init__ (
@@ -44,7 +46,8 @@ def __init__(
4446 headers : dict = None ,
4547 disable_ssl : bool = False ,
4648 retry : Retry = None ,
47- auth : tuple = None
49+ auth : tuple = None ,
50+ proxy : dict = None
4851 ):
4952 """Functions as a Constructor for the class PrometheusConnect."""
5053 if url is None :
@@ -66,6 +69,8 @@ def __init__(
6669 self .auth = auth
6770
6871 self ._session = requests .Session ()
72+ if proxy is not None :
73+ self ._session .proxies = proxy
6974 self ._session .mount (self .url , HTTPAdapter (max_retries = retry ))
7075
7176 def check_prometheus_connection (self , params : dict = None ) -> bool :
You can’t perform that action at this time.
0 commit comments