Python code to pull data using census bureau APIs. It pulls data based on geography, year and type of the table. It is also important to know the name of the data that has to be pulled. The code has examples.
Note: the code is currently written using python 2 version.