|
@@ 144-153 (lines=10) @@
|
| 141 |
|
self.sentry_status_request() |
| 142 |
|
self.active_sentry_api_ip = self.active_sentry_api_list[random.randint(a=0, b=len(self.active_sentry_api_list)-1)] |
| 143 |
|
|
| 144 |
|
def tradehub_post_request(self, path: str, data=None, json_data=None, params=None): |
| 145 |
|
try: |
| 146 |
|
req = Request(api_url="http://{}:5001".format(self.active_sentry_api_ip), timeout=2).post(self, path=path, data=data, json_data=json_data, params=params) |
| 147 |
|
return req |
| 148 |
|
except (ValueError, ConnectionError, HTTPError, Timeout): |
| 149 |
|
self.active_sentry_api_list.remove(self.active_sentry_api_ip) |
| 150 |
|
if not self.active_sentry_api_list: |
| 151 |
|
self.validator_crawler_mp() |
| 152 |
|
self.sentry_status_request() |
| 153 |
|
self.active_sentry_api_ip = self.active_sentry_api_list[random.randint(a=0, b=len(self.active_sentry_api_list)-1)] |
| 154 |
|
|
|
@@ 133-142 (lines=10) @@
|
| 130 |
|
self.sentry_status_request() |
| 131 |
|
self.active_sentry_api_ip = self.active_sentry_api_list[random.randint(a=0, b=len(self.active_sentry_api_list)-1)] |
| 132 |
|
|
| 133 |
|
def tradehub_get_request(self, path: str, params=None): |
| 134 |
|
try: |
| 135 |
|
req = Request(api_url="http://{}:5001".format(self.active_sentry_api_ip), timeout=2).get(path=path, params=params) |
| 136 |
|
return req |
| 137 |
|
except (ValueError, ConnectionError, HTTPError, Timeout): |
| 138 |
|
self.active_sentry_api_list.remove(self.active_sentry_api_ip) |
| 139 |
|
if not self.active_sentry_api_list: |
| 140 |
|
self.validator_crawler_mp() |
| 141 |
|
self.sentry_status_request() |
| 142 |
|
self.active_sentry_api_ip = self.active_sentry_api_list[random.randint(a=0, b=len(self.active_sentry_api_list)-1)] |
| 143 |
|
|
| 144 |
|
def tradehub_post_request(self, path: str, data=None, json_data=None, params=None): |
| 145 |
|
try: |