tuomur / python-odata

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

Getting empty dictionary in Service.entities #39

Open aviasd opened 4 years ago

aviasd commented 4 years ago

I tried to get the data from this site: http://knesset.gov.il/Odata/ParliamentInfo.svc/

This is the code I used:

from odata import ODataService
url = 'http://knesset.gov.il/Odata/ParliamentInfo.svc/'
Service = ODataService(url, reflect_entities=True)
print(len(Service.entities))

The result is:

0

It should return a dictionary with all the tables on the site. There is data on the site, and I think the format is good. Maybe the problem is with the metadata.

Is there a way to fix this? Thanks,

tpow commented 4 years ago

Based on http://knesset.gov.il/Odata/ParliamentInfo.svc/$metadata the site does not appear to support the OData 4 version used by python-odata.

tpow commented 4 years ago

You may want to look at the fork https://github.com/klem4/python-odata

It appears that it has been revised to support OData version 3. I know nothing else about this fork, but did a quick test using it with your code. The result was 38 entities in Service. Perhaps this will work for you.