datamarket 0.8.1__py3-none-any.whl → 0.8.2__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.

@@ -2,8 +2,8 @@
2
2
  # IMPORTS
3
3
 
4
4
  import logging
5
- import time
6
5
  import random
6
+ import time
7
7
 
8
8
  import requests
9
9
  from stem import Signal
@@ -45,7 +45,7 @@ class ProxyInterface:
45
45
  proxy_url = self.get_proxy_url("127.0.0.1", 9050)
46
46
  else:
47
47
  current_host, current_port = self.get_random_host_port() if randomize else self.get_current_host_port()
48
-
48
+
49
49
  user = self.config.get("user")
50
50
  password = self.config.get("password")
51
51
  use_socks = self.config.get("socks", "false").lower() == "true"
@@ -67,14 +67,12 @@ class ProxyInterface:
67
67
  def get_random_host_port(self):
68
68
  hosts = self.config["hosts"].split(",") if isinstance(self.config["hosts"], str) else self.config["hosts"]
69
69
  host_port_pairs = [hp.split(":") for hp in hosts]
70
- self.current_index = random.randint(0, len(host_port_pairs) - 1)
70
+ self.current_index = random.randint(0, len(host_port_pairs) - 1) # noqa: S311
71
71
  return host_port_pairs[self.current_index]
72
72
 
73
73
  def check_current_ip(self):
74
74
  try:
75
- return requests.get(self.CHECK_IP_URL, proxies=self.proxies).json()[
76
- "YourFuckingIPAddress"
77
- ]
75
+ return requests.get(self.CHECK_IP_URL, proxies=self.proxies, timeout=30).json()["YourFuckingIPAddress",]
78
76
  except Exception as ex:
79
77
  logger.error(ex)
80
78
 
datamarket/utils/main.py CHANGED
@@ -63,7 +63,7 @@ def read_converter(path_str: str):
63
63
 
64
64
 
65
65
  def get_config(config_file: Path, tz: str = "Europe/Madrid"):
66
- if Path(config_file).suffix == "ini":
66
+ if Path(config_file).suffix == ".ini":
67
67
  logger.warning("Using legacy INI config reader. Please migrate to TOML")
68
68
  cfg = configparser.RawConfigParser()
69
69
  return cfg.read(config_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamarket
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: Utilities that integrate advanced scraping knowledge into just one library.
5
5
  License: GPL-3.0-or-later
6
6
  Author: DataMarket
@@ -6,18 +6,18 @@ datamarket/interfaces/drive.py,sha256=shbV5jpQVe_KPE-8Idx6Z9te5Zu1SmVfrvSAyd9ZIg
6
6
  datamarket/interfaces/ftp.py,sha256=9GQgiNBBK7njkv8ytHQaP9YLB9kI5vnUFA5gtz9J7As,1859
7
7
  datamarket/interfaces/nominatim.py,sha256=WkPXaug-oH5zJkuE6aXMu4-MEkGYIY7S6TekfZ2FnHY,3658
8
8
  datamarket/interfaces/peerdb.py,sha256=kJ3hdzGEACTfA_HM1b_I2rExY0x6ijCq5eOP1WObpLc,21821
9
- datamarket/interfaces/proxy.py,sha256=vZ42V4zXBWkW7dTGpDvBMNL45MCHe1ZrYrF8xIY25GU,3367
9
+ datamarket/interfaces/proxy.py,sha256=8EJaW8zAMzUMIRLkdAcMkTO9qZXPIubE6vyB5ZXcRtU,3352
10
10
  datamarket/interfaces/tinybird.py,sha256=AYrcRGNOCoCt7ojilkWa27POROee9sTCwZ61GGHEPeM,2698
11
11
  datamarket/params/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  datamarket/params/nominatim.py,sha256=pBYRfoBkkLBg2INbFymefmYSzaAVujQSpEro5c1hD_I,1143
13
13
  datamarket/utils/__init__.py,sha256=8D5a8oKgqd6WA1RUkiKCn4l_PVemtyuckxQut0vDHXM,20
14
14
  datamarket/utils/airflow.py,sha256=al0vc0YUikNu3Oy51VSn52I7pMU40akFBOl_UlHa2E4,795
15
15
  datamarket/utils/alchemy.py,sha256=SRq6kgh1aANXVShBPgAuglmNhZssPWwWEY503gKSia8,635
16
- datamarket/utils/main.py,sha256=4YOwfkYPYSWwJ4JLv7onzj05V5xK3ZnDEAyU3k-qG1A,5532
16
+ datamarket/utils/main.py,sha256=X5m9OMu8XnYYMEnQxvj8PWrT5MxJCftNv48BwDCfk1w,5533
17
17
  datamarket/utils/selenium.py,sha256=IMKlbLzXABFhACnWzhHmB0l2hhVzNwHGZwbo14nEewQ,2499
18
18
  datamarket/utils/soda.py,sha256=eZTXFbI1P3WoMd1MM-YjoVTpdjTcDSWuvBb7ViBMhSQ,941
19
19
  datamarket/utils/typer.py,sha256=FDF3l6gh3UlAFPsHCtesnekvct2rKz0oFn3uKARBQvE,814
20
- datamarket-0.8.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
21
- datamarket-0.8.1.dist-info/METADATA,sha256=nxWllLtCfx8vg9-19Kbtbg4RPqom-j7wt5cIEZB5HtQ,6176
22
- datamarket-0.8.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
23
- datamarket-0.8.1.dist-info/RECORD,,
20
+ datamarket-0.8.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
21
+ datamarket-0.8.2.dist-info/METADATA,sha256=AlcJCKZNiKtQ3S2us0-EkYuKa0Nokyz64O2ZtOu3j3w,6176
22
+ datamarket-0.8.2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
23
+ datamarket-0.8.2.dist-info/RECORD,,