瀏覽代碼

Merged DrkSephy/django-hackathon-starter into default

Wan Kim Mok 10 年之前
父節點
當前提交
8f8f66702d
共有 2 個文件被更改,包括 21 次插入1 次删除
  1. 1 1
      README.md
  2. 20 0
      hackathon_starter/hackathon/scripts/census.py

+ 1 - 1
README.md

@@ -95,7 +95,7 @@ As of `Django 1.7x`, there is a new method called `JsonResponse` which allows th
 
 As of `April 11th, 2015`, there is now a sample AngularJS client which pulls data from the Django sample API endpoint: `http://127.0.0.1:8000/hackathon/snippets/`. To test it, do the following:
 
-* Within the `public/` directory, run `python -m SimpleHTTPServer 80`. You may need `sudo` on your respective Operating System.
+* Within the `angular/` directory, run `python -m SimpleHTTPServer 80`. You may need `sudo` on your respective Operating System.
 * Navigate to: `http://localhost/#/snippets`. Here you will see whatever content was stored within the database model, `Snippet`. If nothing shows up, go back to the `RESTful endpoints` step to populate your database with some `Snippet` objects. 
 
 The following other links are available on the AngularJS Client:

+ 20 - 0
hackathon_starter/hackathon/scripts/census.py

@@ -0,0 +1,20 @@
+'''
+Module containing a handful of methods for 
+aggregating U.S. Census data. 
+'''
+
+import requests
+import simplejson as json
+
+########################
+# CENSUS API CONSTANTS #
+########################
+
+API_BASE_URL = 'http://api.census.gov/data/2013/pep/natstprc'
+
+def getPopulationEstimate(url):
+	req = requests.get(url)
+	print len(req.text)
+	#print req.text
+
+getPopulationEstimate('http://api.census.gov/data/2013/pep/monthlynatchar5?get=AGE,SEX,DATE,RACE5,HISP,POP,UNIVERSE&key=1286203d2772de1f09f13392cc42a0197b2cd414')