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 asClientSession("https://www.mathgenealogy.org")
and callget_record_inner
instead.- Parameters:
record_id (
RecordId
) – Math Genealogy Project ID of the record to retrievecache (
Optional
[Cache
,None
]) – a cache object for getting and storing results
Example:
record = await get_record(RecordId(18231))
- Return type:
Optional
[Record
,None
]
- async geneagrapher_core.record.get_record_inner(record_id, client, http_semaphore=None, cache=None)
Get a single record using the provided
aiohttp.ClientSession
andasyncio.Semaphore
objects. This is useful when making several record requests.- Parameters:
record_id (
RecordId
) – Math Genealogy Project ID of the record to retrieveclient (
ClientSession
) – a client session object with which to make HTTP requestshttp_semaphore (
Optional
[Semaphore
,None
]) – a semaphore to limit HTTP request concurrencycache (
Optional
[Cache
,None
]) – a cache object for getting and storing results
- Return type:
Optional
[Record
,None
]