Skip to content

Commit 0c1e522

Browse files
committed
Merge pull request influxdata#262 from frennkie/add_http_proxy
add option to use Requests http(s) proxy (Thanks @frennkie!)
2 parents 9ccd8dd + 2f129c2 commit 0c1e522

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

influxdb/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class InfluxDBClient(object):
5555
:type use_udp: int
5656
:param udp_port: UDP port to connect to InfluxDB, defaults to 4444
5757
:type udp_port: int
58+
:param proxies: HTTP(S) proxy to use for Requests, defaults to {}
59+
:type proxies: dict
5860
"""
5961

6062
def __init__(self,
@@ -68,6 +70,7 @@ def __init__(self,
6870
timeout=None,
6971
use_udp=False,
7072
udp_port=4444,
73+
proxies=None,
7174
):
7275
"""Construct a new InfluxDBClient object."""
7376
self._host = host
@@ -90,6 +93,11 @@ def __init__(self,
9093
if ssl is True:
9194
self._scheme = "https"
9295

96+
if proxies is None:
97+
self._proxies = {}
98+
else:
99+
self._proxies = proxies
100+
93101
self._baseurl = "{0}://{1}:{2}".format(
94102
self._scheme,
95103
self._host,
@@ -229,6 +237,7 @@ def request(self, url, method='GET', params=None, data=None,
229237
params=params,
230238
data=data,
231239
headers=headers,
240+
proxies=self._proxies,
232241
verify=self._verify_ssl,
233242
timeout=self._timeout
234243
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy