flexmeasures.ui.crud.api_wrapper
Classes
- class flexmeasures.ui.crud.api_wrapper.InternalApi
Simple wrapper around the requests lib, which we use to talk to our actual internal JSON Api via requests. It can only be used to perform requests on the same URL root as the current request. - We use this because it is cleaner than calling the API code directly.
That would re-use the same request we are working on here, which works differently in some ways like content-type and authentication. The Flask/Werkzeug request is also immutable, so we could not adapt the request anyways.
Also, we implement auth token handling
Finally we have some logic to control which error codes we want to raise.