oer_africa.bulk_import

Attributes

plugin

_PLUGIN_DIR

SEARCH_TERM

API_URL

Functions

bulk_translate(...)

bulk_translate_to_json(→ str)

Translate a list of OER Africa resource dicts into a JSON list string.

_fetch_raw(→ str)

bulk_import_async(→ list)

Fetch OER Africa resources and write OME metadata records.

bulk_import(→ list)

Synchronous wrapper around bulk_import_async.

Module Contents

oer_africa.bulk_import.plugin
oer_africa.bulk_import._PLUGIN_DIR
oer_africa.bulk_import.SEARCH_TERM = 'Milk'
oer_africa.bulk_import.API_URL = 'https://www.oerafrica.org/jsonapi/node/resource?filter[fulltext]=Milk&page[limit]=50&sort=-changed'
oer_africa.bulk_import.bulk_translate(resources: list[dict]) collections.abc.Iterator[server.plugins.ome_plugin.EducationResource]
oer_africa.bulk_import.bulk_translate_to_json(resources: list[dict]) str

Translate a list of OER Africa resource dicts into a JSON list string.

async oer_africa.bulk_import._fetch_raw(url: str) str
async oer_africa.bulk_import.bulk_import_async(url: str = API_URL) list

Fetch OER Africa resources and write OME metadata records.

Cached raw API response is stored in oer_africa_bulk.json. Translated OME metadata is stored in oer_africa_ome_metadata.json.

oer_africa.bulk_import.bulk_import(url: str = API_URL) list

Synchronous wrapper around bulk_import_async.