From 435a00b5585e7bc4dbce30178296e8ece4286ce0 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 14 Nov 2023 21:43:41 +0300 Subject: [PATCH] format+fix-5 --- services/core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/core.py b/services/core.py index 6fa3141..18d25a3 100644 --- a/services/core.py +++ b/services/core.py @@ -24,7 +24,7 @@ async def get_all_authors(): import traceback traceback.print_exc() - print(f"[services.core] {query_name}: {response.status_code} {len(response.text)} bytes") + print(f"[services.core] {query_name}: [{response.status_code}] {len(response.text)} bytes") if response.status_code != 200: return None r = response.json() @@ -50,9 +50,13 @@ async def get_my_followings(): import traceback traceback.print_exc() - print(f"[services.core] {query_name}: {response.status_code} {len(response.text)} bytes") + print(f"[services.core] {query_name}: [{response.status_code}] {len(response.text)} bytes") if response.status_code != 200: return None r = response.json() - authors = r.get("data", {}).get(query_name, {}).get("authors", []) - return authors + data = r.get("data") + if data: + authors = data.get(query_name, {}).get("authors", []) + return authors + else: + return []