@@ -94,14 +94,14 @@ def _login(self, username: str, password: str) -> str:
9494
9595 params = json .loads (AUTH_TOKEN_PARAMS .format (session_token ))
9696
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
9898
9999 if response .status_code != 200 :
100100 raise Exception (f"An error occurred while getting the auth token. Status code: { response .status_code } - { response .text } " )
101101
102102 auth_token = session .cookies .get ("auth_token" , domain = "monespace.grdf.fr" )
103103
104- return auth_token
104+ return auth_token # type: ignore
105105
106106 @abstractmethod
107107 def _loadFromSession (self , auth_token : str , pceIdentifier : str , startDate : date , endDate : date , frequencies : Optional [List [Frequency ]] = None ) -> MeterReadingsByFrequency :
@@ -211,7 +211,7 @@ def __downloadFile(self, session: Session, url: str, path: str):
211211
212212 response = session .get (url )
213213
214- if "text/html" in response .headers .get ("Content-Type" ):
214+ if "text/html" in response .headers .get ("Content-Type" ): # type: ignore
215215 raise Exception ("An error occurred while loading data. Please check your credentials." )
216216
217217 if response .status_code != 200 :
@@ -297,7 +297,7 @@ def _loadFromSession(self, auth_token: str, pceIdentifier: str, startDate: date,
297297 try :
298298 response = session .get (downloadUrl )
299299
300- if "text/html" in response .headers .get ("Content-Type" ):
300+ if "text/html" in response .headers .get ("Content-Type" ): # type: ignore
301301 raise Exception ("An error occurred while loading data. Please check your credentials." )
302302
303303 if response .status_code != 200 :
@@ -466,7 +466,7 @@ def computeWeekly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
466466 df = df .sort_values (by = ['first_day_of_week' ])
467467
468468 # 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 ]])
470470
471471 # Select target columns.
472472 df = df [["time_period" , "start_index_m3" , "end_index_m3" , "volume_m3" , "energy_kwh" , "timestamp" ]]
@@ -494,7 +494,7 @@ def computeMonthly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
494494 df = df .sort_values (by = ['first_day_of_month' ])
495495
496496 # 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 ]])
498498
499499 # Rename columns for their target names.
500500 df = df .rename (columns = {"month_year" : "time_period" })
@@ -525,7 +525,7 @@ def computeYearly(daily: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
525525 df = df .sort_values (by = ['year' ])
526526
527527 # 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 ]])
529529
530530 # Rename columns for their target names.
531531 df = df .rename (columns = {"year" : "time_period" })
0 commit comments