the-datagarden 1.2.3__py3-none-any.whl → 1.2.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,6 +41,8 @@ DEFAULT_HEADER: dict[str, str] = {
41
41
 
42
42
 
43
43
  class URLExtension:
44
+ ROOT = ""
45
+ PULSE = "pulse/"
44
46
  WORLD = "world/"
45
47
  WORLD_DATA = "world/regional_data/"
46
48
  CONTINENTS = "continent/"
@@ -26,6 +26,7 @@ from the_datagarden.abc.authentication import DatagardenEnvironment
26
26
  from the_datagarden.api.authentication import AccessToken
27
27
  from the_datagarden.api.authentication.environment import TheDatagardenProductionEnvironment
28
28
  from the_datagarden.api.authentication.settings import (
29
+ DEFAULT_HEADER,
29
30
  SHOW_REQ_DETAIL,
30
31
  DynamicEndpointCategories,
31
32
  URLExtension,
@@ -49,8 +50,17 @@ class BaseDataGardenAPI(BaseApi):
49
50
  password: str | None = None,
50
51
  ):
51
52
  self._environment = environment or TheDatagardenProductionEnvironment
52
- self._tokens = self.ACCESS_TOKEN(self._environment, email, password)
53
53
  self._base_url = self._environment().the_datagarden_url
54
+ self._api_status = self._check_pulse()
55
+ self._tokens = self.ACCESS_TOKEN(self._environment, email, password)
56
+
57
+ def _check_pulse(self) -> bool:
58
+ url = self._generate_url(URLExtension.PULSE)
59
+ response = requests.request(method="GET", url=url, headers=DEFAULT_HEADER.copy())
60
+
61
+ if response.status_code == 200:
62
+ return True
63
+ return False
54
64
 
55
65
  def _generate_url(self, url_extension: str) -> str:
56
66
  url = self._base_url + url_extension
@@ -404,7 +404,7 @@ class TheDataGardenRegionalDataModel:
404
404
 
405
405
  for column, stats in stats_by_column.items():
406
406
  print(
407
- f"{column} : {" " * (max_column_length + 3 - len(column))}"
407
+ f"{column} : {' ' * (max_column_length + 3 - len(column))}"
408
408
  f"{int(stats['count'] + stats['null_count'])}"
409
409
  f" of which with data: {int(stats['count'])} "
410
410
  f"({int(stats['count']) / (int(stats['count'] + stats['null_count'])) * 100:.0f}%)"
@@ -1,13 +1,13 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: the-datagarden
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Summary: Public data made easy.
5
5
  Author-email: Maarten de Ruyter <info@the-datagarden.io>
6
6
  License: MIT
7
7
  Project-URL: Read the Docs, https://dg-the-datagarden.readthedocs.io/en/stable/
8
8
  Project-URL: The-DataGarden, https://www.the-datagarden.io/
9
9
  Project-URL: API documentation, https://www.the-datagarden.io/api-docs
10
- Project-URL: Source, https://github.com/the-datagarden/the-datagarden
10
+ Project-URL: Source, https://github.com/OlivettaDataGarden/dg-the-datagarden
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Programming Language :: Python :: 3.10
13
13
  Classifier: Programming Language :: Python :: 3.11
@@ -6,10 +6,10 @@ the_datagarden/abc/api.py,sha256=RC3PTjrea9asrUfm9XD-AWIcQnhTUyZsBlc8e8leT08,484
6
6
  the_datagarden/abc/authentication.py,sha256=6UJVMAlorMCTjvFMFQLwC_Zx6wyENXQekHHgaLZaouk,1174
7
7
  the_datagarden/api/__init__.py,sha256=tUT1s1J3U5fX6edISvchO-rO0zZ5nJFcG4YUAG0Kwc4,235
8
8
  the_datagarden/api/authentication/__init__.py,sha256=JN20Cpjfes9nFBlDLcojJJyyt_W7_78DoQAdAA9tQW0,3715
9
- the_datagarden/api/authentication/settings.py,sha256=clXnhbV1rOcqyAtTEE4GCso0btqAhrPqveO3kme4WFc,1583
9
+ the_datagarden/api/authentication/settings.py,sha256=uXu544RPhX7m0EyzTH1ANhEr8JhFFyA0h9ks3uTvGMI,1618
10
10
  the_datagarden/api/authentication/credentials/__init__.py,sha256=OXlnUaZ6w-1VIHmCEDKQ7uMZuzKtroeQT_rCl2M0FB8,4806
11
11
  the_datagarden/api/authentication/environment/__init__.py,sha256=9EWOWvinW6C4UAzrPIAI8CqxAM9GErXbo9sKMu5AcH8,426
12
- the_datagarden/api/base/__init__.py,sha256=W-7JCQROnF48rlJuMCqMcqfc3gWRzVMvuxfgkQqOf4k,8165
12
+ the_datagarden/api/base/__init__.py,sha256=8RYikWdbcJVT52Fn8dxrqvjyxs79R5ZqG-p3YrhGps8,8498
13
13
  the_datagarden/api/regions/__init__.py,sha256=oO533d7dn6CEUZQWGGIUBZvpxvJXRDtdZgNUt3rXg4E,98
14
14
  the_datagarden/api/regions/continent.py,sha256=iCsjCvG39bV4zS-4Nj4mvszo1jmKPLWofobByV9G1cg,204
15
15
  the_datagarden/api/regions/country.py,sha256=Uibm8KvvLSa6DGuHz20IW-G08DC7ggIEkx-OYkQMICA,194
@@ -17,9 +17,9 @@ the_datagarden/api/regions/base/__init__.py,sha256=PJ_OnELpbvoJspwuUvse3vxT1ZRBf
17
17
  the_datagarden/api/regions/base/settings.py,sha256=KuUR4r-Iro4ZQpQZjssvRoe7_OJ_LfNfgzJ85UKkgsk,397
18
18
  the_datagarden/models/__init__.py,sha256=UoBC9iK6VfHuW92PeGUteUWAqB0M3qoHDvNBPiNgfhQ,305
19
19
  the_datagarden/models/geojson.py,sha256=74uvrI7YSGgu8ohAMvohKLu6fUkILDT0nZ9l3O4xpis,6340
20
- the_datagarden/models/regional_data.py,sha256=zhk6iRYRlzirgxp1k6J9ftt0mAFqWrTH4M3TPiRfR88,16566
21
- the_datagarden-1.2.3.dist-info/METADATA,sha256=CoUFHZlAKcPcBi1Zivl9YwMQ0h3O3TskUCPbXMLmMC0,15329
22
- the_datagarden-1.2.3.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
23
- the_datagarden-1.2.3.dist-info/entry_points.txt,sha256=R40-UiUsDqy6RfBSnkOCj98Ed0bfvseJPpClXxqVVAM,59
24
- the_datagarden-1.2.3.dist-info/top_level.txt,sha256=S0Wn3mYX0nrwGIqeqWE5vAc3ASTK13E-F_9eTOQu8hs,15
25
- the_datagarden-1.2.3.dist-info/RECORD,,
20
+ the_datagarden/models/regional_data.py,sha256=kHkauaUXaEFTmPKKKc_2yrE8hyC5Xt0HqdvxEXeNrwU,16566
21
+ the_datagarden-1.2.5.dist-info/METADATA,sha256=DjjjZJv0DOa9W8AkMN1ONYXb6tWDGDxfC4WgrnyX_7U,15336
22
+ the_datagarden-1.2.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
23
+ the_datagarden-1.2.5.dist-info/entry_points.txt,sha256=R40-UiUsDqy6RfBSnkOCj98Ed0bfvseJPpClXxqVVAM,59
24
+ the_datagarden-1.2.5.dist-info/top_level.txt,sha256=S0Wn3mYX0nrwGIqeqWE5vAc3ASTK13E-F_9eTOQu8hs,15
25
+ the_datagarden-1.2.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5