Skip to content

Commit 812421a

Browse files
committed
Avoid parsing JSON multiple times
1 parent 5c97615 commit 812421a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

devday_mailbot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ def get_addresses(self) -> list[str]:
6969
while True:
7070
r = get(url, headers={"Authorization": f"Token {self.token}"})
7171
r.raise_for_status()
72+
json_data = r.json()
7273
addresses.extend([
7374
c["email"].lower()
74-
for c in r.json()["results"]
75+
for c in json_data["results"]
7576
if c["is_active"] and c["is_verified"]
7677
])
77-
if not r.json()["next"]:
78+
if not json_data["next"]:
7879
break
79-
url = r.json()["next"]
80+
url = json_data["next"]
8081
return addresses
8182

8283

0 commit comments

Comments
 (0)