Comments (10)
Actually, after playing around with it, the current issue is getting a 403 forbidden on monthlyData
from southern-company-api.
Just tested and monthlyData
still works.
Are you getting the connected
event? Any error
events?
from southern-company-api.
This is the message I get:
Connected...
Fetch Monthly Error FetchError: invalid json response body at https://customerservice2api.southerncompany.com/api/MyPowerUsage/MonthlyGraph/redacted reason: Unexpected end of JSON input
at /mnt/misc/Code/gulf-power/.yarn/cache/node-fetch-npm-2.6.6-056db6b778-ee8290626b.zip/node_modules/node-fetch/lib/index.js:273:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0) {
type: 'invalid-json'
}
Fetch Daily Error FetchError: invalid json response body at https://customerservice2api.southerncompany.com/api/MyPowerUsage/DailyGraph reason: Unexpected end of JSON input
at /mnt/misc/Code/gulf-power/.yarn/cache/node-fetch-npm-2.6.6-056db6b778-ee8290626b.zip/node_modules/node-fetch/lib/index.js:273:32
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Promise.all (index 0) {
type: 'invalid-json'
}
Using this from the docs.
SouthernCompany.on("connected", () => {
console.info("Connected...");
async function fetchMonthly() {
/* Getting Monthly Data */
const monthlyData = await SouthernCompany.getMonthlyData();
/* Printing Monthly Data */
console.info("Monthly Data", JSON.stringify(monthlyData));
}
fetchMonthly().catch((error) => console.log("Fetch Monthly Error", error));
async function fetchDaily() {
/* Getting Daily Data */
const startDate = new Date(2020, 2, 1);
const endDate = new Date();
const dailyData = await SouthernCompany.getDailyData(startDate, endDate);
/* Printing daily data */
console.info("Daily Data", JSON.stringify(dailyData));
}
fetchDaily().catch((error) => console.log("Fetch Daily Error", error));
});
/* Listening for any errors */
SouthernCompany.on("error", console.error);
from southern-company-api.
This is where it fails:
/* Waiting for all requests */
const responses = await Promise.all(requests);
/* Converting all responses to json */
const resData: MonthlyDataResponse[] = await Promise.all(
responses.map((response) => response.json()),
);
In resData
, responses
ends up as an array containing the response:
{
"url": "https://customerservice2api.southerncompany.com/api/MyPowerUsage/MonthlyGraph/redacted",
"status": 403,
"statusText": "Forbidden",
"headers": {},
"counter": 0
}
from southern-company-api.
Interesting, do you have the monthly graphs on the southern company website?
from southern-company-api.
That's another weird thing but I figured it was a separate issue. I use gulfpower which I can login to fine. However, when I go to login on https://webauth.southernco.com/account/login, it just says Login Succeeded then hangs on Logging in forever.
from southern-company-api.
Well, I think gulfpower is not part of southern company. At least not anymore. Assuming based on the options on https://customerservice2.southerncompany.com/Landing
from southern-company-api.
Yup, that's the issue! Gulf Power was sold to another company and is now using a different backend. Unfortunately this library doesn't support that different backend.
from southern-company-api.
No worries. Thanks for taking a look
from southern-company-api.
Anytime! Good luck!
from southern-company-api.
Related Issues (20)
- Tests are not checking validity of data
- Want to switch to node-fetch HOT 1
- Delayed Reading fix HOT 1
- Check if ending date is included or excluded from daily data HOT 1
- obtaining ScJwtToken HOT 8
- Getting 404 on MonthlyGraph API call HOT 4
- API change after 7/8? Null data json HOT 1
- Will this still work with Gulf Power Company even though they were sold to another company? HOT 2
- SouthernCo just introduced Hourly Usage HOT 6
- 🐛 TypeError: Cannot read properties of undefined (reading '1') HOT 1
- Volunteering to help with GA power testing HOT 2
- GA Power Testing HOT 5
- Hourly API for premium subscription HOT 4
- Auth mechanism changed? HOT 5
- Usage no longer takes "AccountNumber" HOT 5
- Dates last year take this year's year
- getMonthlyData does not work without budget billing HOT 1
- API returning back null data when last two days are requested HOT 3
- Move library to v1.0.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from southern-company-api.