tuomur / python-odata

A simple library for read/write access to OData services
MIT License
79 stars 59 forks source link

[WIP] Making it possible to add custom options #41

Open suhrawardi opened 4 years ago

suhrawardi commented 4 years ago

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