Skip to content

Commit

Permalink
fix ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
stickpin committed May 22, 2024
1 parent 9caf079 commit 9ce6047
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions custom_components/meinvodafone/MeinVodafoneAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def login(self) -> bool:
"User-Agent": USER_AGENT,
}

async with self.session.post(url, headers=headers, json=payload) as response:
async with self.session.post(
url, headers=headers, json=payload
) as response:
_LOGGER.debug("Request URL: %s", url)
_LOGGER.debug("Request headers: %s", headers)
_LOGGER.debug("Response headers: %s", response.headers)
Expand Down Expand Up @@ -97,7 +99,9 @@ async def get_contracts(self) -> list:
"X-Vf-Clientid": X_VF_CLIENT_ID,
}

async with self.session.get(url, headers=headers, allow_redirects=False) as response:
async with self.session.get(
url, headers=headers, allow_redirects=False
) as response:
_LOGGER.debug("Request URL: %s", url)
_LOGGER.debug("Request headers: %s", headers)
_LOGGER.debug("Response headers: %s", response.headers)
Expand All @@ -119,7 +123,9 @@ async def get_contracts(self) -> list:
response.text,
)
except Exception as error:
_LOGGER.error("Error during the contracts retrieval proccess, error %s", error)
_LOGGER.error(
"Error during the contracts retrieval proccess, error %s", error
)
return contracts

async def get_contract_usage(self, contract_number) -> dict:
Expand Down Expand Up @@ -151,7 +157,9 @@ async def get_contract_usage(self, contract_number) -> dict:
"daten": DATA,
}

async with self.session.get(url, headers=headers, allow_redirects=False) as response:
async with self.session.get(
url, headers=headers, allow_redirects=False
) as response:
_LOGGER.debug("Request URL: %s", url)
_LOGGER.debug("Request headers: %s", headers)
_LOGGER.debug("Response headers: %s", response.headers)
Expand All @@ -161,8 +169,12 @@ async def get_contract_usage(self, contract_number) -> dict:
service_usage_vbo = response_data.get("serviceUsageVBO", {})
billing_details = service_usage_vbo.get("billDetails", {})

billing_currect_summary = billing_details.get("currentSummary", {}).get("amount")
billing_last_summary = billing_details.get("lastSummary", {}).get("amount")
billing_currect_summary = billing_details.get(
"currentSummary", {}
).get("amount")
billing_last_summary = billing_details.get("lastSummary", {}).get(
"amount"
)
billing_cycle_start = billing_details.get("billCycleStartDate")
billing_cycle_end = billing_details.get("billCycleEndDate")

Expand Down

0 comments on commit 9ce6047

Please sign in to comment.