Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change data source to apidatos.ree.es #39

Merged
merged 13 commits into from
Dec 20, 2021
Merged

Conversation

azogue
Copy link
Owner

@azogue azogue commented Dec 20, 2021

Motivated by recent successful attempts to kick us out from api.esios.ree.es, we are changing the data source to another server, at apidatos.ree.es.

👏 As suggested by @lazynoda in this comment, REE has another public and documented API (REData API) with the same information as the current one, available without authentication 👌, so it may deserve a chance 🤞.

This release implements the new data-source, but also maintains the legacy one.

  • Initial configuration is set with a new data_source parameter, with the new source as default.
  • If a 403 status-code is received, the data source is switched (new to legacy / legacy to new), no retry is done (and the User-Agent loop trick is only used for the legacy data source)

🔥 BREAKING-CHANGE: this release removes support for the old PVPC tariffs (prices < 2021-06-01), and the extra methods to use this library as a dataloader (.download_prices_for_range(...)), leaving only the code to support the HA Core integration.

Changes:

  • 🔥 Remove support for old PVPC tariffs and range download methods,
    and make tariff and websession required arguments

  • ✨ Add alternative data-source from 'apidatos.ree.es'

    • Implement data parsing from apidatos.ree.es, using endpoint at /es/datos/mercados/precios-mercados-tiempo-real
    • Add data_source parameter with valid keys 'apidatos' and 'esios_public', setting the new one as default ;-)
    • Remove retry call if 403 status is received, but maintain the User-Agent loop, and also toggle the data source for the next call
    • Move old ATTRIBUTION to .attribution property, as a function of the data-source
  • 🚚 Change test patterns to new tariffs by substituting old examples in DST days from 2019 to equivalent days since 2021-06, using the new tariff keys

  • 🚚 Add test patterns from new data-source, and adjust tests

* Remove support for old PVPC tariffs
  (assertion error if downloading prices < 2021-06-01)
* Remove `download_prices_for_range` sync method (and its async pair),
  leaving only the logic to access current prices (just for HA Core integration)
* Make `tariff` and `websession` required arguments
by substituting old examples in DST days from 2019
to equivalent days since 2021-06, using the new tariff keys
* Implement data parsing from `apidatos.ree.es`, using endpoint
  at `/es/datos/mercados/precios-mercados-tiempo-real`
* Add `data_source` parameter with valid keys 'apidatos' and 'esios_public',
  setting the new one as default ;-)
* Remove retry call if 403 status is received, but maintain the User-Agent loop,
  and also toggle the data-source for the next call
* Move old ATTRIBUTION to `.attribution` property, as function of the data-source
* Don't use User-Agent for apidatos.ree.es
* Add Host + Content-Type headers
by setting `geo_ids=8744` in query params
* Remove example notebook and extra deps
* Update CHANGELOG.md
@azogue azogue merged commit 600221a into master Dec 20, 2021
@azogue azogue deleted the feature/change-datasource branch January 29, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant