datamarket 0.8.0__py3-none-any.whl → 0.8.1__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.
datamarket/utils/main.py CHANGED
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
25
25
 
26
26
  def get_granular_date(
27
27
  granularity: Union[Literal["monthly", "biweekly", "weekly", "daily"], str], tz: str = "Europe/Madrid"
28
- ) -> str:
28
+ ) -> pendulum.DateTime:
29
29
  """
30
30
  Returns the most recent date based on the given granularity or a custom cron expression.
31
31
 
@@ -52,7 +52,7 @@ def get_granular_date(
52
52
 
53
53
  try:
54
54
  cron = croniter(cron_pattern, now)
55
- return cron.get_prev(pendulum.DateTime).strftime("%Y-%m-%d")
55
+ return cron.get_prev(pendulum.DateTime)
56
56
  except Exception as e:
57
57
  raise ValueError("Invalid cron expression or granularity specified.") from e
58
58
 
@@ -70,12 +70,21 @@ def get_config(config_file: Path, tz: str = "Europe/Madrid"):
70
70
 
71
71
  add_converter("read", read_converter)
72
72
 
73
+ today = get_granular_date("daily", tz)
74
+
73
75
  config = Dynaconf(
74
76
  environments=True,
75
77
  env_switcher="SYSTYPE",
76
78
  vars={
77
- "today": get_granular_date("daily", tz),
78
- "biweekly_date": get_granular_date("biweekly", tz),
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,
79
88
  },
80
89
  )
81
90
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datamarket
3
- Version: 0.8.0
3
+ Version: 0.8.1
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
@@ -13,11 +13,11 @@ datamarket/params/nominatim.py,sha256=pBYRfoBkkLBg2INbFymefmYSzaAVujQSpEro5c1hD_
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=z6gbwR5RhFXYFLkkfCRk14DQsjvSnmJ_GDRd0G5PKgg,5144
16
+ datamarket/utils/main.py,sha256=4YOwfkYPYSWwJ4JLv7onzj05V5xK3ZnDEAyU3k-qG1A,5532
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.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
21
- datamarket-0.8.0.dist-info/METADATA,sha256=1dr2cvGcPu3WVR-lAkWkoHRtQ31eS9uImDwvLtWTi0Q,6176
22
- datamarket-0.8.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
23
- datamarket-0.8.0.dist-info/RECORD,,
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,,