pygazpar 1.3.0a11__py39-none-any.whl → 1.3.0a13__py39-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.
pygazpar/datasource.py CHANGED
@@ -94,14 +94,14 @@ class WebDataSource(IDataSource):
94
94
 
95
95
  params = json.loads(AUTH_TOKEN_PARAMS.format(session_token))
96
96
 
97
- response = session.get(AUTH_TOKEN_URL, params=params, allow_redirects=True, cookies=jar)
97
+ response = session.get(AUTH_TOKEN_URL, params=params, allow_redirects=True, cookies=jar) # type: ignore
98
98
 
99
99
  if response.status_code != 200:
100
100
  raise Exception(f"An error occurred while getting the auth token. Status code: {response.status_code} - {response.text}")
101
101
 
102
102
  auth_token = session.cookies.get("auth_token", domain="monespace.grdf.fr")
103
103
 
104
- return auth_token
104
+ return auth_token # type: ignore
105
105
 
106
106
  @abstractmethod
107
107
  def _loadFromSession(self, auth_token: str, pceIdentifier: str, startDate: date, endDate: date, frequencies: Optional[List[Frequency]] = None) -> MeterReadingsByFrequency:
@@ -211,7 +211,7 @@ class ExcelWebDataSource(WebDataSource):
211
211
 
212
212
  response = session.get(url)
213
213
 
214
- if "text/html" in response.headers.get("Content-Type"):
214
+ if "text/html" in response.headers.get("Content-Type"): # type: ignore
215
215
  raise Exception("An error occurred while loading data. Please check your credentials.")
216
216
 
217
217
  if response.status_code != 200:
@@ -297,7 +297,7 @@ class JsonWebDataSource(WebDataSource):
297
297
  try:
298
298
  response = session.get(downloadUrl)
299
299
 
300
- if "text/html" in response.headers.get("Content-Type"):
300
+ if "text/html" in response.headers.get("Content-Type"): # type: ignore
301
301
  raise Exception("An error occurred while loading data. Please check your credentials.")
302
302
 
303
303
  if response.status_code != 200:
@@ -466,7 +466,7 @@ class FrequencyConverter:
466
466
  df = df.sort_values(by=['first_day_of_week'])
467
467
 
468
468
  # Select rows where we have a full week (7 days) except for the current week.
469
- df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df["count"] < 7]])
469
+ df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df.tail(1)["count"] < 7]])
470
470
 
471
471
  # Select target columns.
472
472
  df = df[["time_period", "start_index_m3", "end_index_m3", "volume_m3", "energy_kwh", "timestamp"]]
@@ -494,7 +494,7 @@ class FrequencyConverter:
494
494
  df = df.sort_values(by=['first_day_of_month'])
495
495
 
496
496
  # Select rows where we have a full month (more than 27 days) except for the current month.
497
- df = pd.concat([df[(df["count"] >= 28)], df.tail(1)[df["count"] < 28]])
497
+ df = pd.concat([df[(df["count"] >= 28)], df.tail(1)[df.tail(1)["count"] < 28]])
498
498
 
499
499
  # Rename columns for their target names.
500
500
  df = df.rename(columns={"month_year": "time_period"})
@@ -525,7 +525,7 @@ class FrequencyConverter:
525
525
  df = df.sort_values(by=['year'])
526
526
 
527
527
  # Select rows where we have almost a full year (more than 360) except for the current year.
528
- df = pd.concat([df[(df["count"] >= 360)], df.tail(1)[df["count"] < 360]])
528
+ df = pd.concat([df[(df["count"] >= 360)], df.tail(1)[df.tail(1)["count"] < 360]])
529
529
 
530
530
  # Rename columns for their target names.
531
531
  df = df.rename(columns={"year": "time_period"})
pygazpar/excelparser.py CHANGED
@@ -33,7 +33,7 @@ class ExcelParser:
33
33
 
34
34
  worksheet = workbook.active
35
35
 
36
- res = parseByFrequency[dataReadingFrequency](worksheet)
36
+ res = parseByFrequency[dataReadingFrequency](worksheet) # type: ignore
37
37
 
38
38
  workbook.close()
39
39
 
pygazpar/jsonparser.py CHANGED
@@ -29,7 +29,7 @@ class JsonParser:
29
29
 
30
30
  for releve in data[pceIdentifier]['releves']:
31
31
  temperature = releve['temperature']
32
- if temperature is None:
32
+ if temperature is None and temperatures is not None and len(temperatures) > 0:
33
33
  temperature = temperatures.get(releve['journeeGaziere'])
34
34
 
35
35
  item = {}
pygazpar/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "1.3.0a11"
1
+ __version__ = "1.3.0a13"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygazpar
3
- Version: 1.3.0a11
3
+ Version: 1.3.0a13
4
4
  Summary: Retrieve gas consumption from GrDF web site (French Gas Company)
5
5
  Home-page: https://github.com/ssenart/pygazpar
6
6
  Author: Stephane Senart
@@ -220,6 +220,16 @@ All notable changes to this project will be documented in this file.
220
220
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
221
221
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
222
222
 
223
+ ## [1.2.5](https://github.com/ssenart/PyGazpar/compare/1.2.5...1.2.4) - 2024-12-21
224
+
225
+ ### Fixed
226
+ - [#75](https://github.com/ssenart/PyGazpar/issues/75): Fix an error when no temperature data is available.
227
+
228
+ ## [1.2.4](https://github.com/ssenart/PyGazpar/compare/1.2.4...1.2.3) - 2024-10-09
229
+
230
+ ### Fixed
231
+ - [#72](https://github.com/ssenart/PyGazpar/issues/72): Remove the warning message "UserWarning: Boolean Series key will be reindexed to match DataFrame index. df = pd.concat([df[(df["count"] >= 7)], df.tail(1)[df["count"] < 7]])".
232
+
223
233
  ## [1.2.3](https://github.com/ssenart/PyGazpar/compare/1.2.3...1.2.1) - 2024-10-05
224
234
 
225
235
  ### Added
@@ -1,11 +1,11 @@
1
1
  pygazpar/__init__.py,sha256=qshO_XZbDA2Wrt80ABDs0MoScqJytClAuIJjAnILglk,309
2
2
  pygazpar/__main__.py,sha256=Pt3PInX7QiWcs0aBKZN90NTaU8KFnrQiZ5Hsow1eR5U,3177
3
3
  pygazpar/client.py,sha256=JdVm0jZbeibwtTumcRbUSFadfXnCUClPMjL95_J6p5Y,2595
4
- pygazpar/datasource.py,sha256=nlIWxZ6SNSHf09BVBFIChSHf4dN05lC3LCxUUDRTylg,21470
4
+ pygazpar/datasource.py,sha256=N9OVdJr4BwtA0W8DvKe4PEE4kLKbSEH2wxAYGNk-iIU,21558
5
5
  pygazpar/enum.py,sha256=3ZCk4SziXF6pxgP3MuQ1qxYfqB3X5DOV8Rtd0GHsK9w,898
6
- pygazpar/excelparser.py,sha256=glWlbj22pxYjHGKurOFmhzcVAoWCvfOHn7_Y6GgHUPo,5915
7
- pygazpar/jsonparser.py,sha256=AWdU3h7UohsOov8HpeP8GNuqcnDmM4r3I7-CI_crDvA,1804
8
- pygazpar/version.py,sha256=_dBppxmPi6eC2EiB3BcrYBcY9pm4iNlyhbySqBY4Y0Y,25
6
+ pygazpar/excelparser.py,sha256=QNFIErXNgMjGGjsGjdnRxAbNpfVagdYmZQtXRub3_Xc,5931
7
+ pygazpar/jsonparser.py,sha256=OrRdMZNBi7rI4dRGoRW7gjyFwJFk-IvtkRZ_t1XVFrI,1859
8
+ pygazpar/version.py,sha256=fteP4W4hbooBmvXetTEMAiyQM-pQD7RL7NcxjAIFl9Y,25
9
9
  pygazpar/resources/daily_data_sample.json,sha256=YJovtrNUMs257magTfyxiewLmecySFypcelbGFUUeT8,199583
10
10
  pygazpar/resources/hourly_data_sample.json,sha256=N1F-Xz3GaBn2H1p7uKzhkhKCQV8QVR0t76XD6wmFtXA,3
11
11
  pygazpar/resources/monthly_data_sample.json,sha256=yrr4SqrB2MubeVU2HX_FRDZKHIhC0LXCqkO1iqnFWcg,3351
@@ -16,12 +16,12 @@ samples/excelSample.py,sha256=ltAl-bBz9-U9YI802JpcIswra-vDS7tR_KL5VNdxJ5c,765
16
16
  samples/jsonSample.py,sha256=sYAIusdEJhZdwDAMgHqoWcwDR0FA2eWhSt_2gL_mJRk,736
17
17
  samples/testSample.py,sha256=UeirdEtezHwfZDv_75oxul17YzGWn5yZuHfJYTF3Ez0,387
18
18
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- tests/test_client.py,sha256=DVGGubMPMM56LvQW-4_pCouvG9qTCbVZVPoRTBGuCU4,5111
19
+ tests/test_client.py,sha256=UiJCqy_Nctl_YDSVpdaYfrbUEzuu9Td22a4WxNnIhJw,5606
20
20
  tests/test_datafileparser.py,sha256=nAeUpOHtelblMpmbrrnf-2GuMjK5ai65veDoymceprE,818
21
21
  tests/test_datasource.py,sha256=Fkn9BOGVKITAgrx9XipR1_ykT7rdvPyt_PAg3ftjfSU,5983
22
- pygazpar-1.3.0a11.dist-info/LICENSE.md,sha256=XsCJx_7_BC9tvmE0ZxS1cTNR7ekurog_ea9ybdZ-8tc,1073
23
- pygazpar-1.3.0a11.dist-info/METADATA,sha256=Ei4SwL0HLpRu-4cLOdeA-4Ybc1FXCwgMYs3ebmqoPt0,18419
24
- pygazpar-1.3.0a11.dist-info/WHEEL,sha256=FQUktIEL0Svmrm0vtDnkVkbaotVNpS5un0v2TQiPCxk,93
25
- pygazpar-1.3.0a11.dist-info/entry_points.txt,sha256=c_FMZPYlRv1w9EqfgWhlkdJOoje7FcglI0UMm2oRLoI,53
26
- pygazpar-1.3.0a11.dist-info/top_level.txt,sha256=P7qn-XtanDPBLQsTvjvLV71wH8RK0DYbx8tzN_rDS70,23
27
- pygazpar-1.3.0a11.dist-info/RECORD,,
22
+ pygazpar-1.3.0a13.dist-info/LICENSE.md,sha256=XsCJx_7_BC9tvmE0ZxS1cTNR7ekurog_ea9ybdZ-8tc,1073
23
+ pygazpar-1.3.0a13.dist-info/METADATA,sha256=nlBR51nRfdgOa7BJuz4fJsg89cJzPEFx_D3e5v2a3gA,18949
24
+ pygazpar-1.3.0a13.dist-info/WHEEL,sha256=E6NuJA_MIt2CDvbuRmqVFG99302DhLXEpOp5wbsbDeU,93
25
+ pygazpar-1.3.0a13.dist-info/entry_points.txt,sha256=c_FMZPYlRv1w9EqfgWhlkdJOoje7FcglI0UMm2oRLoI,53
26
+ pygazpar-1.3.0a13.dist-info/top_level.txt,sha256=P7qn-XtanDPBLQsTvjvLV71wH8RK0DYbx8tzN_rDS70,23
27
+ pygazpar-1.3.0a13.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.44.0)
2
+ Generator: bdist_wheel (0.45.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py39-none-any
5
5
 
tests/test_client.py CHANGED
@@ -52,6 +52,20 @@ class TestClient:
52
52
 
53
53
  assert (len(data[Frequency.HOURLY.value]) == 0)
54
54
 
55
+ def test_one_day_jsonweb(self):
56
+ client = Client(JsonWebDataSource(self.__username, self.__password))
57
+
58
+ data = client.loadSince(self.__pceIdentifier, 1, [Frequency.DAILY])
59
+
60
+ assert (len(data[Frequency.DAILY.value]) <= 1)
61
+
62
+ def test_two_days_jsonweb(self):
63
+ client = Client(JsonWebDataSource(self.__username, self.__password))
64
+
65
+ data = client.loadSince(self.__pceIdentifier, 2, [Frequency.DAILY])
66
+
67
+ assert (len(data[Frequency.DAILY.value]) <= 2)
68
+
55
69
  # @pytest.mark.skip(reason="Requires live data")
56
70
  def test_daily_jsonweb(self):
57
71
  client = Client(JsonWebDataSource(self.__username, self.__password))