ipumspy.api.IpumsApiClient.wait_for_extract

IpumsApiClient.wait_for_extract(extract, collection=None, inital_wait_time=1, max_wait_time=300, timeout=10800)[source]

Convenience function to wait for an extract to complete. Will sleep until the IPUMS API returns a “completed” status for the extract.

Parameters
  • extract (Union[BaseExtract, int]) – The extract to download. This extract must have been submitted. Alternatively, can be an extract id. If an extract id is provided, you must supply the collection name

  • collection (Optional[str]) – The name of the collection to pull the extract from. If None, then extract must be a BaseExtract

  • initial_wait_time – How long in seconds to initially wait between pings to the IPUMS API. Future pings will be spaced by exponential backoff

  • max_wait_time (float) – Pings will always occur at least once every max_wait_time seconds

  • timeout (float) – If this many seconds passes, an IpumsTimeoutException will be raised.

Raises

IpumsTimemoutException – If timeout seconds pass before a “completed” status is returned.