-1

I'm using feedparser to get info from a public database (https://knesset.gov.il/Odata/ParliamentInfo.svc/KNS_Bill()).

Each of my entries looks as follows

When accessing specific properties:

url = 'https://knesset.gov.il/Odata/ParliamentInfo.svc/KNS_Bill()'

feed = feedparser.parse(url)['entries']

bill_id = feed[0].d_billid
bill_name = feed[0].d_name
bill_summary = feed[0].d_summarylaw

print(bill_id)
print(bill_name)
print(bill_summary)

I get outputs that are dictionaries with the tag metadata values:

{'type': 'edm.int32', 'm:type': 'Edm.Int32'}
חוק שכר חברי הכנסת, התש"ט-1949
{'null': 'true', 'm:null': 'true'}

and I can't access the actual values in the tags, for all the ones that have metadata. Is there a way to easily access the actual values instead of only the metadata?

The output I expected to get was:

5
חוק שכר חברי הכנסת, התש"ט-1949
None
Numy
  • 1
  • 1

1 Answers1

0

I Was able to solve the issue by using Beautifulsoup instead of Feedparser.

bill_id = entry.BillID.text
bill_name = entry.Name.text
bill_summary = entry.Summary

Using .text on each element gives the actual value inside.

Numy
  • 1
  • 1
  • In general, questions as well as for answers containing complete examples (including `import` statements e.g.) are more appreciated - That's my opinion. – rocksteady May 21 '22 at 10:04