#!/usr/bin/env python # coding: utf-8 # # Create a Trove OCR corrections ticker # In[1]: # Run this cell first to set things up import time import requests from IPython.display import HTML, clear_output, display params = { "q": "has:corrections", "zone": "newspaper", "encoding": "json", "n": "0", "key": "ju3rgk0jp354ikmh", } def update_corrections(): try: while True: clear_output(wait=True) response = requests.get( "http://api.trove.nla.gov.au/v2/result", params=params ) data = response.json() total = int(data["response"]["zone"][0]["records"]["total"]) display( HTML( '

Trove users have made corrections to {:,} newspaper articles.

'.format( total ) ) ) time.sleep(5) except KeyboardInterrupt: pass # In[2]: # Run this cell to start the ticker # To stop, click the stop button or select Kernel > Interrupt from the menu update_corrections() # ---- # # Created by [Tim Sherratt](https://timsherratt.org/) for the [GLAM Workbench](https://glam-workbench.github.io/). # Support this project by becoming a [GitHub sponsor](https://github.com/sponsors/wragge?o=esb).