From 25f6d1bda516fbac83fa5f92a8bec913cdd0d2df Mon Sep 17 00:00:00 2001 From: nmsderp <130254323+nmsderp@users.noreply.github.com> Date: Sat, 23 Mar 2024 22:29:21 -0400 Subject: [PATCH] Update snailpy.py --- snailpy/snailpy.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/snailpy/snailpy.py b/snailpy/snailpy.py index 2a347fe..4ae4a5c 100644 --- a/snailpy/snailpy.py +++ b/snailpy/snailpy.py @@ -26,6 +26,20 @@ def get_follower_count(username): def id_to_name(args): url = f'{api_url}/api/pmWrapper/getProject?id={args["WHO"]}' + try: + response = requests.get(url) + + if response.status_code == 200: + json_data = response.json() + return json_data.get('name', '') + else: + return "" + except Exception as e: + print(f"An error occurred: {e}") + return "" +def id_to_icon(args): + url = f'{api_url}/api/pmWrapper/iconUrl?id={args["WHO"]}' + try: response = requests.get(url)