I was able to write the following BASH script to extract data from my local town’s utility. Not sure if it is helpful or not or if someone would want to add on. Basically I used developer tools in Chrome and network captured each step from logging in to capturing the daily and hourly data.
#! /bin/bash
# Ask for user input for start date/time
read -p "Enter start date/time (mm/dd/yy hh:mm): " start_datetime
# Ask for user input for end date/time
read -p "Enter end date/time (mm/dd/yy hh:mm): " end_datetime
# Function to convert date/time to Unix timestamp
orig_start=$start_datetime
epoch_start=`expr $(date -d "${orig_start}" +"%s") \* 1000`
epoch_to_date_start=$(date -d @$epoch_start +%Y%m%d_%H%M%S)
orig_end=$end_datetime
epoch_end=`expr $(date -d "${orig_end}" +"%s") \* 1000`
epoch_to_date_end=$(date -d @$epoch_end +%Y%m%d_%H%M%S)
curl 'https://my-town.sensus-analytics.com/j_spring_security_check' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'cache-control: max-age=0' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'cookie: defaultUnits=rain%3DINCHES%7Ctemp%3DF%7Celectric%3DKWH%7Cgas%3DCCF%7Cwater%3DGAL%7C; widgetOrderWATER=Alerts%2CBill%2CGoal%2CWater%2CMActivity%2CNotifications%2CThreshold%2CUsage%2CBudget%2COutdoors%2COUTDOORS%2CPEERS%2CTERMS; widgetOrderGAS=Alerts%2CBill%2CGoal%2CMActivity%2CNotifications%2CThreshold%2CUsage%2COUTDOORS%2CTERMS; widgetOrderELECTRIC=Alerts%2CBill%2CGoal%2CMActivity%2CNotifications%2CThreshold%2CUsage%2COUTDOORS%2CTERMS; disclaimers=false; theme=white; JSESSIONID=074EC68AB845DD09D1E067679EFDCB81; AWSALB=PtQkySWIrRXGSdIb1DjZXkcoT7E1sN1h2JTEcnGzJ8pagm8SzO/p2xIqYVL6VghbMeQllJNOsMC/Ud317sQO7XbCps8mN9ko2Ppbu+x81GhoaPsmxefwNCH4tocC; AWSALBCORS=PtQkySWIrRXGSdIb1DjZXkcoT7E1sN1h2JTEcnGzJ8pagm8SzO/p2xIqYVL6VghbMeQllJNOsMC/Ud317sQO7XbCps8mN9ko2Ppbu+x81GhoaPsmxefwNCH4tocC' \
-H 'dnt: 1' \
-H 'origin: https://my-town.sensus-analytics.com' \
-H 'priority: u=0, i' \
-H 'referer: https://my-town.sensus-analytics.com/login.html' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-fetch-user: ?1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-c cookies.txt \
--data-raw 'j_username=myemailaddress%40gmail.com&j_password=plaintextpassword' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/main.html' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'cache-control: max-age=0' \
-b cookies.txt \
-c cookies2.txt \
-H 'dnt: 1' \
-H 'priority: u=0, i' \
-H 'referer: https://my-town.sensus-analytics.com/login.html' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-fetch-user: ?1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/main.html' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
-H 'accept-language: en-US,en;q=0.9' \
-b cookies2.txt \
-c cookies.txt \
-H 'dnt: 1' \
-H 'priority: u=0, i' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: none' \
-H 'sec-fetch-user: ?1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/login.html' \
-H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
-H 'accept-language: en-US,en;q=0.9' \
-b cookies.txt \
-c cookies2.txt \
-H 'dnt: 1' \
-H 'priority: u=0, i' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: document' \
-H 'sec-fetch-mode: navigate' \
-H 'sec-fetch-site: none' \
-H 'sec-fetch-user: ?1' \
-H 'upgrade-insecure-requests: 1' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/styles/bootstrap.min.css?v=3.5.12.202404221740' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'Referer: https://my-town.sensus-analytics.com/login.html' \
-H 'DNT: 1' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua-platform: "Linux"' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/styles/login.css?v=3.5.12.202404221740' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'Referer: https://my-town.sensus-analytics.com/login.html' \
-H 'DNT: 1' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'sec-ch-ua-platform: "Linux"' \
--silent --output /dev/null ;
curl 'https://my-town.sensus-analytics.com/brand/public/theme?v=3.5.12.202404221740' \
-H 'accept: text/css,*/*;q=0.1' \
-H 'accept-language: en-US,en;q=0.9' \
-b cookies2.txt \
-c cookies.txt \
-H 'dnt: 1' \
-H 'priority: u=0' \
-H 'referer: https://my-town.sensus-analytics.com/login.html' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: style' \
-H 'sec-fetch-mode: no-cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
--silent --output /dev/null ;
eval "
curl 'https://my-town.sensus-analytics.com/water/usage/019146-003/78543712?start="${epoch_start}"&end="${epoch_end}"&zoom=custom&page=null&weather=1' \
-H 'accept: application/json, text/javascript, */*; q=0.01' \
-H 'accept-language: en-US,en;q=0.9' \
-b cookies.txt \
-c cookies2.txt \
-H 'dnt: 1' \
-H 'priority: u=1, i' \
-H 'referer: https://my-town.sensus-analytics.com/main.html' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'x-requested-with: XMLHttpRequest' \
-o waterdata_daily.txt"
eval "
curl 'https://my-town.sensus-analytics.com/water/usage/019146-003/78543712?start="${epoch_start}"&end="${epoch_end}"&zoom=day&page=null&weather=1' \
-H 'accept: application/json, text/javascript, */*; q=0.01' \
-H 'accept-language: en-US,en;q=0.9' \
-b cookies2.txt \
-c cookies.txt \
-H 'dnt: 1' \
-H 'priority: u=1, i' \
-H 'referer: https://my-town.sensus-analytics.com/main.html' \
-H 'sec-ch-ua: "Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' \
-H 'x-requested-with: XMLHttpRequest' \
-o waterdata_hourly.txt"