<commit_before>import requests
#http://api.census.gov/data/2013/acs5?get=NAME,B25035_001E&for=tract:*&in=state:01&key=<KEY>
#http://api.census.gov/data/2013/acs5?get=NAME,B25035_001E&for&county=073&state=01&tract=000100


#http://api.census.gov/data/2013/acs5?get=NAME,B01001_001E&for=tract:000100&in=state:01+county:073&key=212402c9545fabd1b7cbe40772f804f877c8547e
class A_D_report(object):
	def __init__(self):
		pass

class median_age_API(A_D_report):
	def get_age(self, state, county, tract):
		try:
			try:
				with open('/Users/roellk/Documents/api_key.txt', 'r') as f:
					key = f.read()

				api_key = key.strip("'")
				field = 'B25035_001E'
			except:
				print "Error loading API key from file"
			#documentation on ACS 5 year is here: http://www.census.gov/data/developers/data-sets/acs-survey-5-year-data.html
			#the 2013 A&D reports use the ACS 2010 API
			#field = 'B25034_007E'
			#print api_key
			#api_key = '<KEY>'
			#api_url = 'http://api.census.gov/data/2013/'
			#tract = '000700'
			#state = '01'
			#county = '015'
			#x = 'http://api.census.gov/data/2013/acs5?get=NAME,B25035_001E&for=tract:'+tract+'&in=state:'+state+'+county:'+county+'&key='+api_key
			#print x
			r = requests.get('http://api.census.gov/data/2010/acs5?get=NAME,'+field+'&for=tract:'+tract+'&in=state:'+state+'+county:'+county+'&key='+api_key)

			#r = requests.get('http://api.census.gov/data/2013/acs5?get=NAME,'+field+'&for=tract:'+tract+'&in=state:'+state+'+county:'+county+'&key='+api_key)
			#print(r.url)
			median_list =  r.text
			#print tract, state, county
			#print median_list
			#print median_list
			return_list = median_list.split(',')
			#print return_list
			#print return_list[8]
			return return_list[8]
		except:
			print "Unable to connect to Census API"
#age = median_age_API()
#age.get_age('000100', '01', '073')<commit_msg>cleaning old comments<commit_after>import requests
class median_age_API(object):
	def get_age(self, state, county, tract):
		try:
			try:
				with open('/Users/roellk/Documents/api_key.txt', 'r') as f:
					key = f.read()

				api_key = key.strip("'")
				field = 'B25035_001E'
			except:
				print "Error loading API key from file"
			#documentation on ACS 5 year is here: http://www.census.gov/data/developers/data-sets/acs-survey-5-year-data.html
			#the 2013 A&D reports use the ACS 2010 API
			r = requests.get('http://api.census.gov/data/2010/acs5?get=NAME,'+field+'&for=tract:'+tract+'&in=state:'+state+'+county:'+county+'&key='+api_key)
			median_list =  r.text
			return_list = median_list.split(',')
			return return_list[8]
		except:
			print "Unable to connect to Census API"
{'fraction_non_alphanumeric': 0.17477203647416414, 'fraction_numerical': 0.07256838905775076, 'mean_word_length': 4.650214592274678, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3901603', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1048, 'n_words': 173}