pufferfish-tech / octopus-agile-pi-prices

Display the upcoming prices on the Octopus Energy "Agile" tariff.
Apache License 2.0
71 stars 27 forks source link

Need ? Octopus Agile API key #3

Closed Chiny91 closed 4 years ago

Chiny91 commented 4 years ago

I'm still mulling switching to Octopus Agile, as I see I was in January when I hacked a quick Python script together to download the daily prices. I see that I didn't have an Octopus Agile key then, any more than now. So, there appears to be no need for an API key in this code, as stated in the README.md.

I mention this as the project looks interesting, so interesting that I've ordered an Inky pHat. I guess I'm going to find out how it all works the hard way 😄

Chiny91 commented 4 years ago

My Inky pHAT has now arrived and tested OK. Then, just a few minutes after that, I had this program up & running, very easy.

Anyway, I can now confirm that there is no need for an Octopus API key. In store_prices.py I just commented out the API statement (line 3) and the last piece of line 34 which invokes the API key, and all works. No need to expose sensitive API information.

I imagine Octopus are happy for people to experiment in this way, without an API key. It must make for more interest, and more customers.

pufferfish-tech commented 4 years ago

That is interesting, as you say it makes sense to have price data exposed without a key, I guess whoever wrote the octopus api docs didnt' know that part!

So, to clarify, you have it working with store_prices.py line 34:

response = requests.get('https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/'+agile_tariff_code+'/standard-unit-rates/' )

instead of the original: response = requests.get('https://api.octopus.energy/v1/products/AGILE-18-02-21/electricity-tariffs/'+agile_tariff_code+'/standard-unit-rates/', auth=(api_key,'null') )

Am I correct?

Chiny91 commented 4 years ago

Yes, that's correct, no need for an API key.

pufferfish-tech commented 4 years ago

This has now been included in the code, and docs will shortly be updated too