colour_datasets.utilities.json_open#

colour_datasets.utilities.json_open(url: str, retries: int = 3) Dict[source]#

Open given url and return its content as JSON.

Parameters:
  • url (str) – Url to open.

  • retries (int) – Number of retries in case where a networking error occurs.

Returns:

JSON data.

Return type:

dict

Raises:

urllib.error.URLError, ValueError – If the url cannot be opened or parsed as JSON.

Notes

  • The definition caches the request JSON output for 5 minutes.

Examples

>>> json_open("https://zenodo.org/api/records/3245883")
... 
'{"conceptdoi":"10.5281/zenodo.3245882"'