python-odata
python-odata copied to clipboard
[WIP] Making it possible to add custom options
Hi,
I needed to add a custom option to query a Business Central endpoint. Of course I could use the raw query method, but that made me lose the query methods and entity object initialization. I hacked the passing of the options dict, so now I can provide the additional options and keep using the nice query methods.
Service = ODataService(url, session=session, reflect_entities=True)
Supplier = Service.entities['Clients']
options = {'company': os.getenv('COMPANY')}
query = Service.query(Supplier, options=options)
Please let me know your thoughts about this. Is this useful for others? Feedback and ideas on how to improve this PR are very welcome.
Thx, Jarra