Skip to content

Commit cb0ec75

Browse files
author
mayankho
committed
Added Proxy Feature #261
1 parent 8f034f2 commit cb0ec75

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

prometheus_api_client/prometheus_connect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def __init__(
4444
headers: dict = None,
4545
disable_ssl: bool = False,
4646
retry: Retry = None,
47-
auth: tuple = None
47+
auth: tuple = None,
48+
proxy: dict = None
4849
):
4950
"""Functions as a Constructor for the class PrometheusConnect."""
5051
if url is None:
@@ -66,6 +67,8 @@ def __init__(
6667
self.auth = auth
6768

6869
self._session = requests.Session()
70+
if proxy is not None:
71+
self._session.proxies = proxy
6972
self._session.mount(self.url, HTTPAdapter(max_retries=retry))
7073

7174
def check_prometheus_connection(self, params: dict = None) -> bool:

0 commit comments

Comments
 (0)