census.py 489 B

1234567891011121314151617181920
  1. '''
  2. Module containing a handful of methods for
  3. aggregating U.S. Census data.
  4. '''
  5. import requests
  6. import simplejson as json
  7. ########################
  8. # CENSUS API CONSTANTS #
  9. ########################
  10. API_BASE_URL = 'http://api.census.gov/data/2013/pep/natstprc'
  11. def getPopulationEstimate():
  12. url = 'http://api.census.gov/data/2013/pep/natstprc18?get=POPEST18PLUS2013&for=us&key=1286203d2772de1f09f13392cc42a0197b2cd414'
  13. req = requests.get(url)
  14. print req.text
  15. getPopulationEstimate()