From 5bd2d70f7397a9f163de1d82f8f32d1f2cbcedc0 Mon Sep 17 00:00:00 2001
From: jocejocejoe <81094685+jocejocejoe@users.noreply.github.com>
Date: Mon, 18 Oct 2021 13:55:21 -0500
Subject: [PATCH] Use pretty_uri in results if available (#1582)
Per WhatsMyName docs:
"pretty_uri" : "if the check_uri is for an API, this OPTIONAL element can show a human-readable page",
so return this instead of the raw API results if is available.
---
modules/sfp_accounts.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/sfp_accounts.py b/modules/sfp_accounts.py
index 49abd46b62..b41a8c87e6 100644
--- a/modules/sfp_accounts.py
+++ b/modules/sfp_accounts.py
@@ -106,7 +106,11 @@ def checkSite(self, name, site):
return
url = site['check_uri'].format(account=name)
- retname = f"{site['name']} (Category: {site['category']})\n{url}"
+ if 'pretty_uri' in site:
+ ret_url = site['pretty_uri'].format(account=name)
+ else:
+ ret_url = url
+ retname = f"{site['name']} (Category: {site['category']})\n{ret_url}"
res = self.sf.fetchUrl(
url,