def retrieveForYear(year):
r = boto.connect_s3(host="s3.amazonaws.com") \
.get_bucket("irs-form-990") \
.get_key("index_%i.json" % year) \
.get_contents_as_string() \
.replace("\r", "")
j = json.loads(r)
# The index comes back as a single JSON key-value pair whose value is
# a JSON array of length one. Inside _that_ is an array of filings.
filings = j.values()[0]
if cred.prod:
return filings
else:
sample = filings[0:1000]
return sample
评论列表
文章目录