ipumspy.api.IpumsApiClient

class ipumspy.api.IpumsApiClient(api_key, base_url='https://api.ipums.org/extracts', api_version='beta', num_retries=3, session=None)[source]

Class for creating and retrieving IPUMS extracts via API

Parameters
  • api_key (str) – User’s IPUMs API key

  • base_url (str) – IPUMS API url

  • num_retries (int) – number of times a request will be retried before raising TransientIpumsApiException

  • session (Optional[Session]) – requests session object

Methods

__init__

Class for creating and retrieving IPUMS extracts via API

download_extract

Download the extract with id extract_number to download_dir (default location is current directory)

extract_status

Check on the status of an extract request.

extract_was_purged

Returns True if the IPUMS extract's files have been purged from the cache.

get

GET a request from the IPUMS API

get_extract_info

Returns details about a past IPUMS extract

post

POST a request from the IPUMS API

request

Submit a request to the IPUMS API

resubmit_purged_extract

Re-submits an IPUMS extract for which the data and ddi files have been purged from the IPUMS extract system cache.

retrieve_previous_extracts

Return details about the past limit requests

submit_extract

Submit an extract request to the IPUMS API

wait_for_extract

Convenience function to wait for an extract to complete.