From f7c15bdfcd5ba133d4a390282fe8e52340a148af Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 18:26:58 -0400 Subject: [PATCH 1/6] Fix typo in error messages --- packages/redata_reports/run/items_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/redata_reports/run/items_report.py b/packages/redata_reports/run/items_report.py index a97bf0c..8e40f4d 100644 --- a/packages/redata_reports/run/items_report.py +++ b/packages/redata_reports/run/items_report.py @@ -59,7 +59,7 @@ def get_public_article_info(article_ids): unpublished_article_ids.append(id) else: - print('Error getting article versions for {1}, Response code {0}'.format(id, response.status_code)) + print('Error getting article versions for {0}, Response code {1}'.format(id, response.status_code)) return article_info, unpublished_article_ids From 4209285212d16bec5718c015cbcf7a25e42ef7e9 Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 18:44:48 -0400 Subject: [PATCH 2/6] Send public IP of the host to gsheet --- gsheet_webapp/Code.gs | 3 ++- lib/functions.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gsheet_webapp/Code.gs b/gsheet_webapp/Code.gs index a2eef73..d6fae7a 100644 --- a/gsheet_webapp/Code.gs +++ b/gsheet_webapp/Code.gs @@ -61,11 +61,12 @@ function doPost(e){ objJSON = JSON.parse(jsonString); action = objJSON.action; key = objJSON.accesskey; + srcip = objJSON.from_ip; if(key != SCRIPT_PROP.getProperty("accesskey")) throw new Error("Invalid access key."); - Logger.info(action); + Logger.info(action + " from " + srcip); result = handleAction(action, objJSON); diff --git a/lib/functions.py b/lib/functions.py index df16c5a..9c4a641 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -52,6 +52,7 @@ def sync_to_dashboard(data, report): return 'No data to send' postdata = {"action": "insertupdate", + "from_ip:" get_public_ip(), "sheet": report, "accesskey": environ['GSHEETS_DASHBOARD_KEY'], "data": data} @@ -200,6 +201,22 @@ def format_duration(duration_string: str, target_unit: str, append_unit: bool=Fa return f'{converted_duration:.2f} {target_unit}' if append_unit else f'{converted_duration:.2f}' +def get_public_ip(): + """ + Returns the publicly visible IP address of the current host + """ + try: + r = requests.get("https://checkip.amazonaws.com") + if r.status_code == 200: + return r.text.strip() + else: + print(f"Error getting public IP address of the current host. {0}", r.status_code) + return("Unknown") + except Exception as e: + print(f"Error executing requests.get. {0}", e.message) + return("Unknown") + + def get_report_outfile(reportname, prefix=''): """ Returns a writable file in the current directory From 0d922187a4ae1f367fc70560ea07570247635d73 Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 18:45:09 -0400 Subject: [PATCH 3/6] Bump gsheet version --- gsheet_webapp/Code.gs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsheet_webapp/Code.gs b/gsheet_webapp/Code.gs index d6fae7a..0560cdb 100644 --- a/gsheet_webapp/Code.gs +++ b/gsheet_webapp/Code.gs @@ -16,7 +16,7 @@ var SCRIPT_PROP = PropertiesService.getScriptProperties(); // new property service -version="2.0.0"; //change when the version changes +version="2.1.0"; //change when the version changes //Best practice for using BetterLog and logging to a spreadsheet: // You can add and set the property "BetterLogLevel" in File > Project Properties and change it to From e55ee4248dd4609dca7c57761e6e6428564454a4 Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 18:46:52 -0400 Subject: [PATCH 4/6] Bump report versions --- packages/redata_reports/run/version.py | 2 +- packages/trello_reports/run/version.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/redata_reports/run/version.py b/packages/redata_reports/run/version.py index 9c86b93..e2751da 100644 --- a/packages/redata_reports/run/version.py +++ b/packages/redata_reports/run/version.py @@ -14,4 +14,4 @@ def get_commit(repo_path): __commit__ = get_commit('.') -__version__ = '1.1.2' +__version__ = '1.2.0' diff --git a/packages/trello_reports/run/version.py b/packages/trello_reports/run/version.py index cea651d..a7d7d2c 100644 --- a/packages/trello_reports/run/version.py +++ b/packages/trello_reports/run/version.py @@ -14,4 +14,4 @@ def get_commit(repo_path): __commit__ = get_commit('.') -__version__ = '1.0.0' +__version__ = '1.1.0' From f942d024c4c1625f7d6f22d18ca8993057fdfb8a Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 18:49:56 -0400 Subject: [PATCH 5/6] Fix syntax error --- lib/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.py b/lib/functions.py index 9c4a641..97b0c8b 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -52,7 +52,7 @@ def sync_to_dashboard(data, report): return 'No data to send' postdata = {"action": "insertupdate", - "from_ip:" get_public_ip(), + "from_ip": get_public_ip(), "sheet": report, "accesskey": environ['GSHEETS_DASHBOARD_KEY'], "data": data} From d1eaaf4bed8477e64998625b3865bf4ba1fe335a Mon Sep 17 00:00:00 2001 From: Fernando Rios Date: Thu, 9 Apr 2026 19:05:56 -0400 Subject: [PATCH 6/6] Improve logs in items report --- packages/redata_reports/run/items_report.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/redata_reports/run/items_report.py b/packages/redata_reports/run/items_report.py index 8e40f4d..89d229b 100644 --- a/packages/redata_reports/run/items_report.py +++ b/packages/redata_reports/run/items_report.py @@ -114,7 +114,7 @@ def run(args): if len(r2) > 0: unpublished_article_ids.append(r2) - print("total public articles (excluding removed articles): {0}".format(len(public_articles_info))) + print("total processed public articles (excluding removed articles): {0}".format(len(public_articles_info))) print('Getting usage by private articles') private_articles = [item for item in institution_articles if item['published_date'] is None] @@ -135,6 +135,8 @@ def run(args): if len(r) > 0: private_articles_info.append(r) + print("total private articles processed (including removed articles): {0}".format(len(private_articles_info))) + articles = [] total_usage = 0 for article in public_articles_info + private_articles_info: