datamarket 0.7.100__py3-none-any.whl → 0.7.101__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/exceptions/main.py +6 -0
- datamarket/utils/main.py +6 -3
- {datamarket-0.7.100.dist-info → datamarket-0.7.101.dist-info}/METADATA +1 -1
- {datamarket-0.7.100.dist-info → datamarket-0.7.101.dist-info}/RECORD +6 -6
- {datamarket-0.7.100.dist-info → datamarket-0.7.101.dist-info}/LICENSE +0 -0
- {datamarket-0.7.100.dist-info → datamarket-0.7.101.dist-info}/WHEEL +0 -0
datamarket/exceptions/main.py
CHANGED
|
@@ -12,3 +12,9 @@ class NotFoundError(Exception):
|
|
|
12
12
|
def __init__(self, message="Not found!"):
|
|
13
13
|
self.message = message
|
|
14
14
|
super().__init__(self.message)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BadRequestError(Exception):
|
|
18
|
+
def __init__(self, message="Bad request!"):
|
|
19
|
+
self.message = message
|
|
20
|
+
super().__init__(self.message)
|
datamarket/utils/main.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import configparser
|
|
6
|
+
from datetime import timedelta
|
|
6
7
|
import logging
|
|
7
8
|
import random
|
|
8
9
|
import re
|
|
@@ -25,7 +26,7 @@ from tenacity import (
|
|
|
25
26
|
wait_exponential,
|
|
26
27
|
)
|
|
27
28
|
|
|
28
|
-
from ..exceptions import RedirectionDetectedError, NotFoundError
|
|
29
|
+
from ..exceptions import RedirectionDetectedError, NotFoundError, BadRequestError
|
|
29
30
|
from ..interfaces.proxy import ProxyInterface
|
|
30
31
|
|
|
31
32
|
########################################################################################################################
|
|
@@ -131,7 +132,7 @@ def parse_field(dict_struct, field_path, format_method=None):
|
|
|
131
132
|
|
|
132
133
|
|
|
133
134
|
@retry(
|
|
134
|
-
retry=retry_if_not_exception_type((NotFoundError, RedirectionDetectedError, ProxyError)),
|
|
135
|
+
retry=retry_if_not_exception_type((NotFoundError, BadRequestError, RedirectionDetectedError, ProxyError)),
|
|
135
136
|
wait=wait_exponential(exp_base=3, multiplier=3, max=60),
|
|
136
137
|
stop=stop_after_attempt(5),
|
|
137
138
|
before_sleep=before_sleep_log(logger, logging.WARNING),
|
|
@@ -144,7 +145,7 @@ def get_data(
|
|
|
144
145
|
sleep: tuple = (6, 3),
|
|
145
146
|
proxy_interface: ProxyInterface = None,
|
|
146
147
|
use_auth_proxies: bool = False,
|
|
147
|
-
max_proxy_delay:
|
|
148
|
+
max_proxy_delay: timedelta = timedelta(minutes=10),
|
|
148
149
|
**kwargs,
|
|
149
150
|
):
|
|
150
151
|
retry_type = retry_if_exception_type(ProxyError)
|
|
@@ -175,6 +176,8 @@ def get_data(
|
|
|
175
176
|
|
|
176
177
|
if r.status_code == 404:
|
|
177
178
|
raise NotFoundError(f"404 Not Found error for {url}")
|
|
179
|
+
if r.status_code == 400:
|
|
180
|
+
raise BadRequestError(f"400 Bad Request error for {url}")
|
|
178
181
|
r.raise_for_status()
|
|
179
182
|
r.encoding = "utf-8"
|
|
180
183
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
datamarket/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
datamarket/exceptions/__init__.py,sha256=-Vu-RZNKjW6fYCLqbUJTkKNuHeA8Yi_gyR50oZNaA_8,33
|
|
3
|
-
datamarket/exceptions/main.py,sha256=
|
|
3
|
+
datamarket/exceptions/main.py,sha256=AlPOzLoJT14QSNT7hHvvDBxfNew50evFUgCZ9FxF9lA,607
|
|
4
4
|
datamarket/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
datamarket/interfaces/alchemy.py,sha256=i2lKLLLy3-jpbzV3-jxfRCXTy7jRoTsNU3063pmSonk,15749
|
|
6
6
|
datamarket/interfaces/aws.py,sha256=co5JkC3iFIp-0FqdYX4eKy3_m71LhZKuJoW6kXwEImc,4780
|
|
@@ -16,7 +16,7 @@ datamarket/params/nominatim.py,sha256=RnmYXGoJQCijOsuCavCYcxw98WvOd_vOMK4KaraI0R
|
|
|
16
16
|
datamarket/utils/__init__.py,sha256=FHLh-Qp9XpM4LkAocppCf_llW2CWVVghGorkqxqt1wk,34
|
|
17
17
|
datamarket/utils/airflow.py,sha256=al0vc0YUikNu3Oy51VSn52I7pMU40akFBOl_UlHa2E4,795
|
|
18
18
|
datamarket/utils/alchemy.py,sha256=SRq6kgh1aANXVShBPgAuglmNhZssPWwWEY503gKSia8,635
|
|
19
|
-
datamarket/utils/main.py,sha256=
|
|
19
|
+
datamarket/utils/main.py,sha256=1F-Klw7GX59BkRvWbTl3j7gX6MneZwlI3KOTmJK4P8Q,6040
|
|
20
20
|
datamarket/utils/nominatim.py,sha256=IxexKY2KOlDhiKtzsqQfoVUjJXPxJl7tn3iHUaQKg08,5795
|
|
21
21
|
datamarket/utils/playwright/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
datamarket/utils/playwright/async_api.py,sha256=UbA2D4ScBtYeMfrRjly4RO-s8wXIub9c05J1eoOCpsQ,5782
|
|
@@ -29,7 +29,7 @@ datamarket/utils/strings/obfuscation.py,sha256=Jo-x3f2Cb75983smmpcdPqUlBrLCTyrnm
|
|
|
29
29
|
datamarket/utils/strings/standardization.py,sha256=c8CAG6HI3AfK0hB3A3IGwsbnQebZ6R3PrA5PELHRXM0,1492
|
|
30
30
|
datamarket/utils/typer.py,sha256=FDF3l6gh3UlAFPsHCtesnekvct2rKz0oFn3uKARBQvE,814
|
|
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.101.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
datamarket-0.7.101.dist-info/METADATA,sha256=1UzLpLNWiHpv7qTEzfxCwvfUfZVzAMAYa5hAihtNdiQ,7382
|
|
34
|
+
datamarket-0.7.101.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
35
|
+
datamarket-0.7.101.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|