Get a Single Record

To get a single record, use the get_record function. If you are requesting many records, consider using get_record_inner, which allows you to reuse an aiohttp.ClientSession and optionally pass a asyncio.Semaphore to cap maximum HTTP request concurrency.

async geneagrapher_core.record.get_record(record_id, cache=None)

Get a single record. This is meant to be called for one-off requests. If the calling code is planning to get several records during its lifetime, it should instantiate a aiohttp.ClientSession object as ClientSession("https://www.mathgenealogy.org") and call get_record_inner instead.

Parameters:
  • record_id (NewType(RecordId, int)) – Math Genealogy Project ID of the record to retrieve

  • cache (Optional[Cache]) – a cache object for getting and storing results

Return type:

Optional[Record]

Example:

record = await get_record(RecordId(18231))
async geneagrapher_core.record.get_record_inner(record_id, client, http_semaphore=None, cache=None)

Get a single record using the provided aiohttp.ClientSession and asyncio.Semaphore objects. This is useful when making several record requests.

Parameters:
  • record_id (NewType(RecordId, int)) – Math Genealogy Project ID of the record to retrieve

  • client (ClientSession) – a client session object with which to make HTTP requests

  • http_semaphore (Optional[Semaphore]) – a semaphore to limit HTTP request concurrency

  • cache (Optional[Cache]) – a cache object for getting and storing results

Return type:

Optional[Record]