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)