datamarket 0.8.1__py3-none-any.whl → 0.8.3__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 +4 -6
- datamarket/utils/main.py +14 -12
- {datamarket-0.8.1.dist-info → datamarket-0.8.3.dist-info}/METADATA +1 -1
- {datamarket-0.8.1.dist-info → datamarket-0.8.3.dist-info}/RECORD +6 -6
- {datamarket-0.8.1.dist-info → datamarket-0.8.3.dist-info}/LICENSE +0 -0
- {datamarket-0.8.1.dist-info → datamarket-0.8.3.dist-info}/WHEEL +0 -0
datamarket/interfaces/proxy.py
CHANGED
|
@@ -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)
|
|
@@ -75,21 +75,23 @@ def get_config(config_file: Path, tz: str = "Europe/Madrid"):
|
|
|
75
75
|
config = Dynaconf(
|
|
76
76
|
environments=True,
|
|
77
77
|
env_switcher="SYSTYPE",
|
|
78
|
-
vars={
|
|
79
|
-
"now": today.strftime("%Y-%m-%d %H:%M:%S"),
|
|
80
|
-
"today": today.strftime("%Y-%m-%d"),
|
|
81
|
-
"year": today.strftime("%Y"),
|
|
82
|
-
"month": today.strftime("%m"),
|
|
83
|
-
"day": today.strftime("%d"),
|
|
84
|
-
"biweekly_date": get_granular_date("biweekly", tz).strftime("%Y-%m-%d"),
|
|
85
|
-
"today_stripped": today.strftime("%Y%m%d"),
|
|
86
|
-
"now_stripped": today.strftime("%Y%m%d%H%M%S"),
|
|
87
|
-
"dynaconf_merge": True,
|
|
88
|
-
},
|
|
89
78
|
)
|
|
90
79
|
|
|
91
80
|
config.load_file(path=config_file)
|
|
92
81
|
config.load_file(path=Path.home() / config_file.name)
|
|
82
|
+
|
|
83
|
+
config.vars = {
|
|
84
|
+
"now": today.strftime("%Y-%m-%d %H:%M:%S"),
|
|
85
|
+
"today": today.strftime("%Y-%m-%d"),
|
|
86
|
+
"year": today.strftime("%Y"),
|
|
87
|
+
"month": today.strftime("%m"),
|
|
88
|
+
"day": today.strftime("%d"),
|
|
89
|
+
"biweekly_date": get_granular_date("biweekly", tz).strftime("%Y-%m-%d"),
|
|
90
|
+
"today_stripped": today.strftime("%Y%m%d"),
|
|
91
|
+
"now_stripped": today.strftime("%Y%m%d%H%M%S"),
|
|
92
|
+
"dynaconf_merge": True,
|
|
93
|
+
}
|
|
94
|
+
|
|
93
95
|
return config
|
|
94
96
|
|
|
95
97
|
|
|
@@ -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=
|
|
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=
|
|
16
|
+
datamarket/utils/main.py,sha256=SD0qVMQrGPCxRx2MCw4lsGmsLABMWLdbYdCr7d5G8U8,5499
|
|
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.
|
|
21
|
-
datamarket-0.8.
|
|
22
|
-
datamarket-0.8.
|
|
23
|
-
datamarket-0.8.
|
|
20
|
+
datamarket-0.8.3.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
21
|
+
datamarket-0.8.3.dist-info/METADATA,sha256=X-38YnliUdR5PQlVyLsnVNZwJXg3_76XUzIAJl8Bdtc,6176
|
|
22
|
+
datamarket-0.8.3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
23
|
+
datamarket-0.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|