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.ClientSessionobject asClientSession("https://www.mathgenealogy.org")and callget_record_innerinstead.- Parameters:
- Return type:
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.ClientSessionandasyncio.Semaphoreobjects. This is useful when making several record requests.- Parameters:
record_id (
NewType(RecordId,int)) – Math Genealogy Project ID of the record to retrieveclient (
ClientSession) – a client session object with which to make HTTP requestshttp_semaphore (
Optional[Semaphore]) – a semaphore to limit HTTP request concurrencycache (
Optional[Cache]) – a cache object for getting and storing results
- Return type: