Spaces:
Sleeping
Sleeping
Commit ·
e833b51
1
Parent(s): c769bac
proxy pool retry added
Browse files- proxy_pool.py +3 -3
proxy_pool.py
CHANGED
|
@@ -9,7 +9,7 @@ class ProxyPool:
|
|
| 9 |
self.target_count = options.get('target_count', 20)
|
| 10 |
self.batch_size = options.get('batch_size', 20)
|
| 11 |
self.test_timeout = options.get('test_timeout', 5)
|
| 12 |
-
self.request_timeout = options.get('request_timeout',
|
| 13 |
self.target_url = options.get('target_url', 'https://app.freeplay.ai/')
|
| 14 |
self.concurrent_requests = options.get('concurrent_requests', 10)
|
| 15 |
self.min_threshold = options.get('min_threshold', 5)
|
|
@@ -128,7 +128,7 @@ class ProxyPool:
|
|
| 128 |
if data.get('code') == 200:
|
| 129 |
print(f"Successfully got {data['data']['count']} proxies")
|
| 130 |
return data['data']['proxies']
|
| 131 |
-
print(f"Failed to get proxies: {response.text}")
|
| 132 |
return []
|
| 133 |
except Exception as e:
|
| 134 |
print(f"Error getting proxies: {e}")
|
|
@@ -145,7 +145,7 @@ class ProxyPool:
|
|
| 145 |
if is_valid:
|
| 146 |
print(f"Proxy {proxy_url} successfully tested, status: {response.status_code}")
|
| 147 |
else:
|
| 148 |
-
print(f"Proxy {proxy_url} failed test, status: {response.status_code}")
|
| 149 |
return is_valid
|
| 150 |
except Exception as e:
|
| 151 |
print(f"Proxy {proxy_url} request error: {e}")
|
|
|
|
| 9 |
self.target_count = options.get('target_count', 20)
|
| 10 |
self.batch_size = options.get('batch_size', 20)
|
| 11 |
self.test_timeout = options.get('test_timeout', 5)
|
| 12 |
+
self.request_timeout = options.get('request_timeout', 5)
|
| 13 |
self.target_url = options.get('target_url', 'https://app.freeplay.ai/')
|
| 14 |
self.concurrent_requests = options.get('concurrent_requests', 10)
|
| 15 |
self.min_threshold = options.get('min_threshold', 5)
|
|
|
|
| 128 |
if data.get('code') == 200:
|
| 129 |
print(f"Successfully got {data['data']['count']} proxies")
|
| 130 |
return data['data']['proxies']
|
| 131 |
+
print(f"Failed to get proxies. Status: {response.status_code}, Response: {response.text}")
|
| 132 |
return []
|
| 133 |
except Exception as e:
|
| 134 |
print(f"Error getting proxies: {e}")
|
|
|
|
| 145 |
if is_valid:
|
| 146 |
print(f"Proxy {proxy_url} successfully tested, status: {response.status_code}")
|
| 147 |
else:
|
| 148 |
+
print(f"Proxy {proxy_url} failed test, status: {response.status_code}, headers: {response.headers}")
|
| 149 |
return is_valid
|
| 150 |
except Exception as e:
|
| 151 |
print(f"Proxy {proxy_url} request error: {e}")
|