python-odata icon indicating copy to clipboard operation
python-odata copied to clipboard

Getting empty dictionary in Service.entities

Open aviasd opened this issue 5 years ago • 2 comments

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,

aviasd avatar Mar 01 '20 23:03 aviasd

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 avatar Mar 14 '20 19:03 tpow

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.

tpow avatar Mar 14 '20 19:03 tpow