datamarket 0.7.104__py3-none-any.whl → 0.7.105__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of datamarket might be problematic. Click here for more details.
- datamarket/interfaces/proxy.py +17 -9
- {datamarket-0.7.104.dist-info → datamarket-0.7.105.dist-info}/METADATA +1 -1
- {datamarket-0.7.104.dist-info → datamarket-0.7.105.dist-info}/RECORD +5 -5
- {datamarket-0.7.104.dist-info → datamarket-0.7.105.dist-info}/LICENSE +0 -0
- {datamarket-0.7.104.dist-info → datamarket-0.7.105.dist-info}/WHEEL +0 -0
datamarket/interfaces/proxy.py
CHANGED
|
@@ -179,13 +179,13 @@ class ProxyInterface:
|
|
|
179
179
|
return
|
|
180
180
|
|
|
181
181
|
try:
|
|
182
|
-
logger.
|
|
182
|
+
logger.debug(f"Current IP: {self.check_current_ip()}")
|
|
183
183
|
with Controller.from_port(port=9051) as controller:
|
|
184
184
|
controller.authenticate(password=self.tor_password)
|
|
185
185
|
controller.signal(Signal.NEWNYM)
|
|
186
186
|
|
|
187
187
|
time.sleep(5)
|
|
188
|
-
logger.
|
|
188
|
+
logger.debug(f"New IP: {self.check_current_ip()}")
|
|
189
189
|
except Exception as ex:
|
|
190
190
|
logger.error("Failed to renew Tor IP")
|
|
191
191
|
logger.error(ex)
|
|
@@ -231,6 +231,11 @@ class ProxyInterface:
|
|
|
231
231
|
pool = self._build_pool(use_auth)
|
|
232
232
|
candidates = self._get_candidates(pool, randomize)
|
|
233
233
|
|
|
234
|
+
# Capture baseline before any health checks that might set it
|
|
235
|
+
baseline_before = None
|
|
236
|
+
if len(candidates) == 1:
|
|
237
|
+
baseline_before = self._health.get(candidates[0], {}).get("last_ip")
|
|
238
|
+
|
|
234
239
|
def _find_working_entry():
|
|
235
240
|
if not self.entries:
|
|
236
241
|
raise NoWorkingProxiesError("No proxies available")
|
|
@@ -246,13 +251,16 @@ class ProxyInterface:
|
|
|
246
251
|
entry = _find_working_entry()
|
|
247
252
|
|
|
248
253
|
if ensure_new_ip and len(pool) == 1:
|
|
249
|
-
logger.
|
|
254
|
+
logger.debug(f"ensure_new_ip=True and single proxy, handling IP change check: {entry[0]}:{entry[1]}")
|
|
250
255
|
baseline = self._health.get(entry, {}).get("last_ip")
|
|
251
|
-
if not
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
+
if not baseline_before:
|
|
257
|
+
# First time seeing this proxy: it was already checked in _find_working_entry, so return immediately
|
|
258
|
+
logger.debug("No baseline IP found; returning first-working proxy without waiting for IP change")
|
|
259
|
+
else:
|
|
260
|
+
# There is a baseline: wait for the IP to change
|
|
261
|
+
entry = self._wait_for_new_ip(
|
|
262
|
+
entry, baseline, ensure_new_ip_timeout, ensure_new_ip_interval, check_timeout
|
|
263
|
+
)
|
|
256
264
|
|
|
257
265
|
return entry
|
|
258
266
|
|
|
@@ -327,7 +335,7 @@ class ProxyInterface:
|
|
|
327
335
|
|
|
328
336
|
if current_ip and current_ip != baseline:
|
|
329
337
|
self.mark_entry_status(entry, True, last_ip=current_ip)
|
|
330
|
-
logger.
|
|
338
|
+
logger.debug(f"IP changed from {baseline} to {current_ip}")
|
|
331
339
|
return entry
|
|
332
340
|
|
|
333
341
|
time.sleep(interval)
|
|
@@ -9,7 +9,7 @@ datamarket/interfaces/drive.py,sha256=3nhx3THr2SHNWKYwme9F2nPpvsqyEMFIxz0whF2FjH
|
|
|
9
9
|
datamarket/interfaces/ftp.py,sha256=LH3Oz19k_xUNhzDXcrq5Ofb4c3uiph5pWUqpgiaDvHI,2671
|
|
10
10
|
datamarket/interfaces/nominatim.py,sha256=xizT94tVum7QPppfDgI5sEhx1mAXT-SM3JyPl8CDxxU,15148
|
|
11
11
|
datamarket/interfaces/peerdb.py,sha256=sO451wEGNb_0DDwchZ6eBVYKltqHM5XKau-WsfspXzA,23640
|
|
12
|
-
datamarket/interfaces/proxy.py,sha256=
|
|
12
|
+
datamarket/interfaces/proxy.py,sha256=j2m7T9mv18XXnkIhApsCDdG2tUAdnmDLWv1nHTNYHNI,13410
|
|
13
13
|
datamarket/interfaces/tinybird.py,sha256=cNG-kAPTdQn2inlNX9LPf-VVdtnLud947ApLVO40Now,2594
|
|
14
14
|
datamarket/params/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
datamarket/params/nominatim.py,sha256=S9TEB4FxmffvFyK9KffWl20TfXzWX69IAdbEehKar1I,11920
|
|
@@ -29,7 +29,7 @@ datamarket/utils/strings/obfuscation.py,sha256=Jo-x3f2Cb75983smmpcdPqUlBrLCTyrnm
|
|
|
29
29
|
datamarket/utils/strings/standardization.py,sha256=j_NbT-O1XnxDvDhct8panfkrfAC8R5OX6XM5fYBZ4RU,1496
|
|
30
30
|
datamarket/utils/typer.py,sha256=geWuwMwGQjBQhxo27hX0vEAeRl1j1TS0u2oFVfpAs5I,816
|
|
31
31
|
datamarket/utils/types.py,sha256=vxdQZdwdXrfPR4Es52gBgol-tMRIOD6oK9cBo3rB0JQ,74
|
|
32
|
-
datamarket-0.7.
|
|
33
|
-
datamarket-0.7.
|
|
34
|
-
datamarket-0.7.
|
|
35
|
-
datamarket-0.7.
|
|
32
|
+
datamarket-0.7.105.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
datamarket-0.7.105.dist-info/METADATA,sha256=2uuHjpJUomXAU9YJYoRtnQPDZxPBSfbWtQ6RWgm4srk,7382
|
|
34
|
+
datamarket-0.7.105.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
35
|
+
datamarket-0.7.105.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|