From 64b43a3f75cecab98f17792e4e507db7b04b2613 Mon Sep 17 00:00:00 2001 From: s4w3d0ff Date: Mon, 6 Nov 2017 10:46:41 -0800 Subject: [PATCH] Add proxy support #167 --- poloniex/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/poloniex/__init__.py b/poloniex/__init__.py index 2ed67663..e4ce09de 100644 --- a/poloniex/__init__.py +++ b/poloniex/__init__.py @@ -108,7 +108,7 @@ class Poloniex(object): def __init__( self, key=False, secret=False, - timeout=None, coach=True, jsonNums=False): + timeout=None, coach=True, jsonNums=False, proxies=None): """ key = str api key supplied by Poloniex secret = str secret hash supplied by Poloniex @@ -120,9 +120,10 @@ def __init__( # Time Placeholders: (MONTH == 30*DAYS) self.MINUTE, self.HOUR, self.DAY, self.WEEK, self.MONTH, self.YEAR """ - # set logger and coach + # set logger, coach, and proxies self.logger = logger self.coach = coach + self.proxies = proxies if self.coach is True: self.coach = Coach() # create nonce @@ -201,7 +202,10 @@ def __call__(self, command, args={}): # add headers to payload payload['headers'] = {'Sign': sign.hexdigest(), 'Key': self.key} - + # add proxies if needed + if self.proxies: + payload['proxies'] = self.proxies + # send the call ret = _post(**payload) @@ -216,7 +220,9 @@ def __call__(self, command, args={}): # wait for coach if self.coach: self.coach.wait() - + # add proxies if needed + if self.proxies: + payload['proxies'] = self.proxies # send the call ret = _get(**payload)