dirkjanfaber / node-red-contrib-eskomsepush

Node-RED node for the EskomsePush API
MIT License
7 stars 2 forks source link

Request failed with status code 429 #3

Closed Ohwelt closed 1 year ago

Ohwelt commented 1 year ago

Hi, With the EskomSepush Free account and curl on MacOS and my token, I am getting a proper result. See below.

With that same token and the same area Id using your node I get the following error message in the debug window: error: "Request failed with status code 429"

I am using Node Red V3.02 and have enough token left.


curl --location --request GET 'https://developer.sepush.co.za/business/2.0/area?id=eskmo-13-belabelawarmbadtownbelabelalimpopo' \

--header 'token: XXXXXXXX-XXXXXXXX-XXXXXXXX-DE6B65CD'

{"events":[{"end":"2023-06-11T23:30:00+02:00","note":"Stage 4","start":"2023-06-11T21:00:00+02:00"},{"end":"2023-06-12T15:30:00+02:00","note":"Stage 1","start":"2023-06-12T13:00:00+02:00"},{"end":"2023-06-12T23:30:00+02.........

dirkjanfaber commented 1 year ago

A statuscode of 429 indicates too many requests from the user in a short period: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429.

Not saying that there is nothing wrong in the code, but it might help to retry after a while of no requests. Leaving this issue open for now to be sure that it is gets resolved after a period of no requests.

Ohwelt commented 1 year ago

I retried after a few hours and received the same result - while it (always) works with curl command as often (no waiting time) as I use it (and I have tokens). In my opinion, it is nearly impossible to develop my own flow with the EskomSePush node when I cannot trigger it with an inject command to test as often as I need to until my flow works properly (and while I have tokens left.). Creating a flow with the node and to always wait an hour to see if it works like I want it to, is not realistic. Also the test=current is not really helpful as I need to test with real data before connecting it to the my PV Inverter.

In order to see, if the problem is the node or the API , I created my own function using the curl and header command. The result is also quite interesting.

Checking with: msg.headers['token'] = 'XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX'; https://developer.sepush.co.za/business/2.0/api_allowance results in: "{"allowance":{"count":1,"limit":50,"type":"daily"}}↵"

Testing with: msg.headers['token'] = 'XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX'; https://developer.sepush.co.za/business/2.0/area?id=eskmo-13-belabelawarmbadtownbelabelalimpopo&test=current results in: "{"events":[{"end":"2023-06-11T20:30:00+02:00","note":"Stage 8 (TESTING: current)","start":"2023-06-11T18:00:00+02:00"}],"info":{"name":"TESTING Bela Bela(Warmbad) Town (13)","region":"Eskom Municipal, Belabela, Limpopo"},"schedule":{"days":[{"date":"2023-06-11","name":"Sunday","stages":[["12:00-14:30"],["04:00-06:30","12:0............

And requesting a schedule with: msg.headers['token'] = 'XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX'; https://developer.sepush.co.za/business/2.0/area?id=eskmo-13-belabelawarmbadtownbelabelalimpopo results in: "{"error":"Free account abuse detected - Limited access \ud83d\ude40. Please pay if you can."}↵"

Something is really not working properly here.

Thanks for your help.

Ohwelt commented 1 year ago

A statuscode of 429 indicates too many requests from the user in a short period: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429.

That is solved: I had two token that I tried from Node Red running on Cerbo. If the EskomSePush API recognises two different token coming from the same IP it blocks them. The curl command executed on the Mac worked, because they came from a different IP.

dirkjanfaber commented 1 year ago

Ah, that is good to know. Thanks! I'll close this issue then.