Skip to content

Getting "KeyError: 'd'" when reading XML OData #83

Open
@aviasd

Description

@aviasd

I'm trying to read from this site:
http://knesset.gov.il/Odata/ParliamentInfo.svc/

The site is in XML and every table is saved in XML too.
For example:
http://knesset.gov.il/Odata/ParliamentInfo.svc/KNS_Agenda

When reading with python-pyodata, there is a key error when trying to get entities.

Code:

import requests
import pyodata

SERVICE_URL = 'http://knesset.gov.il/Odata/ParliamentInfo.svc/'

# Create instance of OData client
client = pyodata.Client(SERVICE_URL, requests.Session())

# This is the problematic line
a = client.entity_sets.KNS_Agenda.get_entities().execute()

The exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.6/site-packages/pyodata/v2/service.py", line 305, in execute
    return self._handler(response)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/pyodata/v2/service.py", line 1102, in get_entities_handler
    entities = content['d']['results']
KeyError: 'd'

Is there a way to fix this?

Thanks in advance,

Metadata

Metadata

Assignees

No one assigned

    Labels

    V3OData V3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions