Skip to content

Commit bcc2319

Browse files
committed
Make get_membership_data consistent with other service calls
1 parent 689a460 commit bcc2319

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

hackspaceapi/services/website.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
from typing import Iterable, Optional
23

34
import requests
45
from cachetools.func import ttl_cache
@@ -12,7 +13,7 @@
1213

1314
@ttl_cache(ttl=1800)
1415
@website_metric_summary.time()
15-
def get_membership_data() -> list:
16+
def get_membership_data() -> Optional[Iterable]:
1617
url = "https://web-test.leighhack.org/membership/index.json"
1718
try:
1819
resp = requests.get(url)
@@ -22,4 +23,4 @@ def get_membership_data() -> list:
2223
except requests.exceptions.RequestException as exc:
2324
logging.error("Failed query Website data - {0}: {1}".format(url, exc))
2425
pass
25-
return []
26+
return None

hackspaceapi/spaceapi.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ def get_links() -> list:
215215

216216
def get_membership_plans() -> list:
217217
data = get_membership_data()
218+
if not data:
219+
return []
218220

219221
output = []
220222
for plan in data:

0 commit comments

Comments
 (0)