The homepage for the CPSC API can be found at: http://www.cpsc.gov/en/Recalls/CPSC-Recalls-Application-Program-Interface-API-Information/
There's even a programmer's manual: http://www.cpsc.gov/Global/info/Recall/CPSC-Recalls-Retrieval-Web-Services-Programmers-Guide_3-25-2015.pdf
And here's a stashed version of the 2016 data (as of April):
http://stash.compjour.org/samples/cpsc/recalls201604.json
However, a bare call of the endpoint -- http://www.saferproducts.gov/RestWebServices/Recall?format=json -- with no parameters beyond specifying JSON as the format seems to yield the entire collection: ~6,700 records at around 20MB.
Here's a script that downloads the data file, stores it locally for later parsing, and then does a quick frequency count:
from collections import Counter
import requests
import json
SOURCE_URL = 'http://www.saferproducts.gov/RestWebServices/Recall'
FNAME = 'saferproducts-recalls.json'
print("Downloading from", SOURCE_URL, 'saving to', FNAME)
resp = requests.get(SOURCE_URL, params={'format': 'json'})
with open(FNAME, 'w') as wf:
wf.write(resp.text)
data = resp.json()
print("Number of records:", len(data))
# frequency count by year
c = Counter(d['RecallDate'][0:4] for d in data)
for z in sorted(c.items()):
print('%s: %s' % (z[0], str(z[1]).rjust(4)))
Output:
Downloading from http://www.saferproducts.gov/RestWebServices/Recall saving to saferproducts-recalls.json
Number of records: 6695
1973: 8
1974: 14
1975: 13
1976: 27
1977: 36
1978: 43
1979: 33
1980: 22
1981: 12
1982: 23
1983: 23
1984: 44
1985: 30
1986: 46
1987: 49
1988: 75
1989: 80
1990: 78
1991: 84
1992: 82
1993: 75
1994: 109
1995: 128
1996: 139
1997: 151
1998: 127
1999: 133
2000: 174
2001: 234
2002: 255
2003: 216
2004: 278
2005: 323
2006: 320
2007: 452
2008: 393
2009: 388
2010: 362
2011: 315
2012: 312
2013: 289
2014: 293
2015: 309
2016: 98