👋 Enable ORM classes definitions before API credentials access. #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello @jgoclawski. At Semeia-io we use socialwifi jsonapi-requests. We picked it due to its simplicity of use. We thank you very much for the work 💯 !
We use a slightly modified version of your work that enables our python services to interact with our rails API via the ORM part. These services are using Flask, and connect to the API on a user specific base via an authentication forwarding mechanism.
Our additions to the original work aim at enabling two features the way we use them:
Inside this first submission is the code that enables us to do the first point.
The base principle is to subclass
ApiModelwith a newDeferredAuthApiModelfor which we rewrite a metaclass object to delay the options creation via theOptionsFactory.getusage to the__call__stage of this new metaclass.This modification goes hand in hand with an interface contract specifying that any subclass implementing the
DeferredAuthApiModelmust implement theapiclassmethod itself.This is verified at metaclass
__call__time as well, and will raise a NotImplementedError in case this classmethod is not present on the child class.I can open a second PR with the modifications that enable us to build query strings programmatically based on Fields.