Skip to content

Commit

Permalink
Use formdata function
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Jan 7, 2024
1 parent c24ae36 commit a55f0df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sagemcom_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ async def __api_request_async(self, actions, priority=False):
}
}

async with self.session.post(
api_host, data="req=" + json.dumps(payload, separators=(",", ":"))
) as response:
form_data = {"req": json.dumps(payload, separators=(",", ":"))}

async with self.session.post(api_host, data=form_data) as response:
if response.status == 400:
result = await response.text()
raise BadRequestException(result)
Expand Down Expand Up @@ -245,6 +245,7 @@ async def __api_request_async(self, actions, priority=False):
async def login(self):
"""TODO."""
actions = {
"id": 0,
"method": "logIn",
"parameters": {
"user": self.username,
Expand Down

0 comments on commit a55f0df

Please sign in to comment.