Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeftor committed Oct 24, 2023
1 parent f93230d commit 79324c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "intellifire4py"
version = "3.1.19"
version = "3.1.21"
description = "Intellifire4Py"
authors = ["Jeff Stein <[email protected]>"]
license = "MIT"
Expand Down
16 changes: 15 additions & 1 deletion src/intellifire4py/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,21 @@ async def _send_cloud_command(
# Construct body
url = f"{self.prefix}://iftapi.net/a/{serial}/apppost"
content = f"{command.value['cloud_command']}={value}".encode()
response = await client.post(url, content=content)
response = await client.post(url, content=content, cookies=self._cookie)

# Log request details
req = response.request

headers = " ".join([f"-H '{k}: {v}'" for k, v in req.headers.items()])
cookies = " ".join(
[f"-b '{k}={v}'" for k, v in response.cookies.items()]
) # assuming httpx supports this in the future version
data = f"--data '{req.content.decode()}'"
curl_cmd = f"curl -X {req.method} {headers} {cookies} {data} {req.url}"
self._log.debug(f"Generated curl command: {curl_cmd}")

log_msg = f"POST {url} [{content.decode()}] [{self._cookie}]"
self._log.debug(log_msg)

log_msg = f"POST {url} [{content.decode()}] [{self._cookie}]"
self._log.debug(log_msg)
Expand Down

0 comments on commit 79324c8

Please sign in to comment.