@@ -89,7 +89,7 @@ class EventHubClient(object):
89
89
events to and receiving events from the Azure Event Hubs service.
90
90
"""
91
91
92
- def __init__ (self , address , username = None , password = None , debug = False ):
92
+ def __init__ (self , address , username = None , password = None , debug = False , http_proxy = None ):
93
93
"""
94
94
Constructs a new EventHubClient with the given address URL.
95
95
@@ -105,10 +105,15 @@ def __init__(self, address, username=None, password=None, debug=False):
105
105
:param debug: Whether to output network trace logs to the logger. Default
106
106
is `False`.
107
107
:type debug: bool
108
+ :param http_proxy: HTTP proxy settings. This must be a dictionary with the following
109
+ keys: 'proxy_hostname' (str value) and 'proxy_port' (int value).
110
+ Additionally the following keys may also be present: 'username', 'password'.
111
+ :type http_proxy: dict[str, Any]
108
112
"""
109
113
self .container_id = "eventhub.pysdk-" + str (uuid .uuid4 ())[:8 ]
110
114
self .address = urlparse (address )
111
115
self .eh_name = self .address .path .lstrip ('/' )
116
+ self .http_proxy = http_proxy
112
117
self .mgmt_target = "amqps://{}/{}" .format (self .address .hostname , self .eh_name )
113
118
url_username = unquote_plus (self .address .username ) if self .address .username else None
114
119
username = username or url_username
@@ -169,8 +174,10 @@ def _create_auth(self, username=None, password=None):
169
174
username = username or self ._auth_config ['username' ]
170
175
password = password or self ._auth_config ['password' ]
171
176
if "@sas.root" in username :
172
- return authentication .SASLPlain (self .address .hostname , username , password )
173
- return authentication .SASTokenAuth .from_shared_access_key (self .auth_uri , username , password , timeout = 60 )
177
+ return authentication .SASLPlain (
178
+ self .address .hostname , username , password , http_proxy = self .http_proxy )
179
+ return authentication .SASTokenAuth .from_shared_access_key (
180
+ self .auth_uri , username , password , timeout = 60 , http_proxy = self .http_proxy )
174
181
175
182
def create_properties (self ): # pylint: disable=no-self-use
176
183
"""
0 commit comments