Skip to content

Commit

Permalink
Fix to spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Bre77 committed Mar 17, 2024
1 parent a50f4e3 commit bf663da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions teslemetry_stream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ async def __anext__(self) -> dict:
# Connect to the stream
await self.connect()
async for line_in_bytes in self._response.content:
if raw := line_in_bytes.decode("utf8").partition(": ")[2]:
data = json.loads(raw)
field, _, value = line_in_bytes.decode("utf8").partition(": ")
if field == "data":
data = json.loads(value)
if self.parse_timestamp:
main, _, ns = data["createdAt"].partition(".")
data["timestamp"] = int(
Expand Down

0 comments on commit bf663da

Please sign in to comment.