dev@cloudburo

Python Tutorial Exercise 3: Implement the govAPI_UK class

Write a govAPI_UK implementation class which retrieves the following attributes from the UK government API:
  • family name
  • given ame
  • gender
  • party
  • id (by extracting the number out of the _about attributes)

Below you see a dedicated record of the members API endpoint. You can access the viewer via the following link:




Some programming hints:
  • When you have fetched the JSON and stored in a variable, i.e. loaded_json you have to iterate over the array found in
    loaded_json[‘result’][‘items’] this is actually the members list
  • As request parameter provide
    • pageSize=500 store this values as part of the config_UK.yaml file (refer to the govAPI_CH class implementation)
    • _page which you count up for each page you request (again refer to the govAPI_CH class)
      • For the loop condition you can use the attribute totalResults, which is provided as an element in the JSON document.
      • I.e. fetch “x” times 500 records until you retrieved overall 4451 records.





comments powered by Disqus