Skip to content

Commit

Permalink
fix missing await
Browse files Browse the repository at this point in the history
  • Loading branch information
chemwolf6922 committed Dec 19, 2024
1 parent c847b9b commit 7d6c3dc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions custom_components/xiaomi_home/miot/miot_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,9 @@ async def __mihome_api_post_async(
self, url_path: str, data: dict,
timeout: int = MIHOME_HTTP_API_TIMEOUT
) -> dict:
form_data = aiohttp.FormData()
form_data.add_field('data', json.dumps(data))
http_res = await self._session.post(
url=f'{self._base_url}{url_path}',
data=form_data,
json=data,
headers=self.__api_request_headers,
timeout=timeout)
if http_res.status == 401:
Expand Down Expand Up @@ -365,7 +363,7 @@ async def get_central_cert_async(self, csr: str) -> Optional[str]:
if not isinstance(csr, str):
raise MIoTHttpError('invalid params')

res_obj: dict = self.__mihome_api_post_async(
res_obj: dict = await self.__mihome_api_post_async(
url_path='/app/v2/ha/oauth/get_central_crt',
data={
'csr': str(base64.b64encode(csr.encode('utf-8')), 'utf-8')
Expand Down

0 comments on commit 7d6c3dc

Please sign in to comment.