+ RETRIABLE_CALLS = [
+ re.compile(r"^return"),
+ re.compile(r"^cancel"),
+ re.compile(r"^closeMarginPosition$"),
+ re.compile(r"^getMarginPosition$"),
+ ]
+
+ def request(self, path, api='public', method='GET', params={}, headers=None, body=None):
+ """
+ Wrapped to allow retry of non-posting requests"
+ """
+
+ origin_request = super(poloniexE, self).request
+ kwargs = {
+ "api": api,
+ "method": method,
+ "params": params,
+ "headers": headers,
+ "body": body
+ }
+
+ retriable = any(re.match(call, path) for call in self.RETRIABLE_CALLS)
+ if api == "public" or method == "GET" or retriable:
+ return retry_call(origin_request, fargs=[path], fkwargs=kwargs,
+ tries=10, delay=1, exceptions=(RequestTimeout,))
+ else:
+ return origin_request(path, **kwargs)
+