Skip to content

Commit 3f544e7

Browse files
authored
fix: json attribute error for GET with parameters (#477)
1 parent 8275916 commit 3f544e7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

teslajsonpy/connection.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,14 @@ async def __open(
200200

201201
try:
202202
if data:
203-
resp: httpx.Response = await getattr(self.websession, method)(
204-
str(url), json=data, headers=headers, cookies=cookies
205-
)
203+
if method == "get":
204+
resp: httpx.Response = await getattr(self.websession, method)(
205+
str(url), params=data, headers=headers, cookies=cookies
206+
)
207+
else:
208+
resp: httpx.Response = await getattr(self.websession, method)(
209+
str(url), json=data, headers=headers, cookies=cookies
210+
)
206211
else:
207212
resp: httpx.Response = await getattr(self.websession, method)(
208213
str(url), headers=headers, cookies=cookies

0 commit comments

Comments
 (0)