Search code examples
pythonodata

OData example not working (Python)


I'm running this code that I got from here

https://tuomur-python-odata.readthedocs.io/en/latest/#what-is-this

from odata import ODataService
url = 'http://services.odata.org/V4/Northwind/Northwind.svc/'
Service = ODataService(url, reflect_entities=True)
Order = Service.entities['Order']
query = Service.query(Order)
query = query.filter(Order.Name.startswith('Demo'))
query = query.order_by(Order.ShippedDate.desc())
for order in query:
    print(order.Name)

When I run the code, it says ImportError: No module named odata. I tried using pip install odata, nothing was found. How do I install this library? I can't find any documentation on how to install it either.


Solution

  • Download the project from GitHub, run python setup.py install, sudo if necessary.