In [1]:
from datetime import datetime
import os
import pyopenstates
import sys

def get_state_abbr(state):
    return state.get('abbreviation')


def query_state(state, search_terms):
    """
    https://openstates.github.io/pyopenstates/pyopenstates%20module.html#pyopenstates.search_bills
    uses keyworded argument in function
    """
    print('Query for ' + state + ' bills')

    bills = pyopenstates.search_bills(state=state, q=search_terms)

    return bills

In [2]:
pyopenstates.set_api_key('api key here')

metadata = pyopenstates.get_metadata()
states = list(map(get_state_abbr, metadata))

In [5]:
search = 'firearms'

states_bills_firearms = {}

for state in states:
    bills = query_state(state, search)
    states_bills_firearms[state] = bills


Query for al bills
Query for ak bills
Query for az bills
Query for ar bills
Query for ca bills
Query for co bills
Query for ct bills
Query for de bills
Query for dc bills
Query for fl bills
Query for ga bills
Query for hi bills
Query for id bills
Query for il bills
Query for in bills
Query for ia bills
Query for ks bills
Query for ky bills
Query for la bills
Query for me bills
Query for md bills
Query for ma bills
Query for mi bills
Query for mn bills
Query for ms bills
Query for mo bills
Query for mt bills
Query for ne bills
Query for nv bills
Query for nh bills
Query for nj bills
Query for nm bills
Query for ny bills
Query for nc bills
Query for nd bills
Query for oh bills
Query for ok bills
Query for or bills
Query for pa bills
Query for pr bills
Query for ri bills
Query for sc bills
Query for sd bills
Query for tn bills
Query for tx bills
Query for ut bills
Query for vt bills
Query for va bills
Query for wa bills
Query for wv bills
Query for wi bills
Query for wy bills

In [8]:
print(states_bills_firearms['tx'])


[{u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2017, 7, 24, 5, 20, 12), u'updated_at': datetime.datetime(2017, 8, 1, 5, 30, 49), u'chamber': u'lower', u'state': u'tx', u'session': u'851', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00058778', u'bill_id': u'HB 216'}, {u'title': u'Relating to restrictive covenants regarding firearms or firearms ammunition.', u'created_at': datetime.datetime(2017, 3, 11, 8, 35, 13), u'updated_at': datetime.datetime(2017, 6, 5, 10, 27, 59), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'Housing and Property', u'Other', u'Guns'], u'type': [u'bill'], u'id': u'TXB00055618', u'bill_id': u'SB 1943'}, {u'title': u'Relating to the regulation or taxation of firearms, air guns, knives, or ammunition by a municipality or county.', u'created_at': datetime.datetime(2017, 1, 18, 3, 3, 26), u'updated_at': datetime.datetime(2017, 6, 16, 10, 11, 59), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'Budget, Spending, and Taxes', u'Municipal and County Issues', u'Guns'], u'type': [u'bill'], u'id': u'TXB00049522', u'bill_id': u'SB 459'}, {u'title': u'Relating to the transportation and storage of firearms and ammunition in private vehicles on the campuses of institutions of higher education.', u'created_at': datetime.datetime(2017, 2, 27, 6, 46, 3), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 45), u'chamber': u'lower', u'state': u'tx', u'session': u'85', u'subjects': [u'Education', u'Guns'], u'type': [u'bill'], u'id': u'TXB00051879', u'bill_id': u'HB 2105'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 53), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 10), u'chamber': u'lower', u'state': u'tx', u'session': u'85', u'subjects': [u'Judiciary', u'Executive Branch', u'Crime', u'Campaign Finance and Election Issues', u'State Agencies', u'Guns'], u'type': [u'bill'], u'id': u'TXB00048160', u'bill_id': u'HB 110'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition; creating a criminal offense.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 54), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 40), u'chamber': u'lower', u'state': u'tx', u'session': u'85', u'subjects': [u'Guns'], u'type': [u'bill'], u'id': u'TXB00048403', u'bill_id': u'HB 99'}, {u'title': u'Relating to the regulation of firearms, air guns, knives, ammunition, and firearm and air gun supplies; imposing a civil penalty.', u'created_at': datetime.datetime(2017, 1, 18, 3, 3, 24), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 29), u'chamber': u'lower', u'state': u'tx', u'session': u'85', u'subjects': [u'Campaign Finance and Election Issues', u'Guns', u'Municipal and County Issues', u'Executive Branch'], u'type': [u'bill'], u'id': u'TXB00049463', u'bill_id': u'HB 927'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 54), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 49), u'chamber': u'lower', u'state': u'tx', u'session': u'85', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00048379', u'bill_id': u'HB 485'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition.', u'created_at': datetime.datetime(2017, 1, 10, 5, 54, 41), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 9), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00049213', u'bill_id': u'SB 450'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 52), u'updated_at': datetime.datetime(2017, 6, 5, 10, 27, 37), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00047973', u'bill_id': u'SB 133'}, {u'title': u'Relating to prohibiting certain physician questions regarding firearms.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 55), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 3), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'State Agencies', u'Health', u'Guns'], u'type': [u'bill'], u'id': u'TXB00048739', u'bill_id': u'SB 104'}, {u'title': u'Relating to prohibiting public funds from being used to enforce certain federal or international laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2016, 12, 28, 0, 23, 56), u'updated_at': datetime.datetime(2017, 6, 5, 10, 28, 27), u'chamber': u'upper', u'state': u'tx', u'session': u'85', u'subjects': [u'Guns', u'Executive Branch', u'Crime'], u'type': [u'bill'], u'id': u'TXB00048808', u'bill_id': u'SB 93'}, {u'title': u'Relating to defenses and exceptions to the prosecution of the criminal offense of the possession, manufacture, transport, repair, or sale of certain prohibited explosive weapons, firearms, and related items.', u'created_at': datetime.datetime(2015, 2, 8, 1, 38, 46), u'updated_at': datetime.datetime(2016, 4, 28, 8, 30, 42), u'chamber': u'upper', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00037097', u'bill_id': u'SB 473'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2015, 1, 23, 1, 4, 28), u'updated_at': datetime.datetime(2016, 4, 28, 8, 39, 21), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00036301', u'bill_id': u'HB 849'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2015, 1, 7, 22, 8, 49), u'updated_at': datetime.datetime(2015, 5, 12, 20, 32, 42), u'chamber': u'upper', u'state': u'tx', u'session': u'84', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00035816', u'bill_id': u'SB 228'}, {u'title': u'Relating to restrictive covenants regarding firearms or firearms ammunition.', u'created_at': datetime.datetime(2015, 3, 12, 21, 35, 6), u'updated_at': datetime.datetime(2016, 4, 28, 8, 33, 58), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Housing and Property', u'Other', u'Guns'], u'type': [u'bill'], u'id': u'TXB00041947', u'bill_id': u'HB 2999'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2015, 1, 7, 22, 6, 31), u'updated_at': datetime.datetime(2016, 4, 28, 8, 30, 12), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00035496', u'bill_id': u'HB 422'}, {u'title': u'Relating to the transportation and storage of firearms and ammunition in private vehicles on the campuses of institutions of higher education.', u'created_at': datetime.datetime(2015, 2, 21, 2, 20, 41), u'updated_at': datetime.datetime(2016, 4, 28, 8, 29, 56), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Education', u'Guns'], u'type': [u'bill'], u'id': u'TXB00038121', u'bill_id': u'HB 1649'}, {u'title': u'Relating to defenses and exceptions to the prosecution of the criminal offense of the possession, manufacture, transport, repair, or sale of certain prohibited explosive weapons, firearms, and related items.', u'created_at': datetime.datetime(2015, 1, 30, 23, 57), u'updated_at': datetime.datetime(2016, 4, 28, 8, 30, 55), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00036593', u'bill_id': u'HB 989'}, {u'title': u'Relating to the duties of certain law enforcement officials under procedures regulating the making or transfer of firearms.', u'created_at': datetime.datetime(2015, 2, 8, 1, 39, 1), u'updated_at': datetime.datetime(2016, 4, 28, 8, 40, 27), u'chamber': u'upper', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00037133', u'bill_id': u'SB 476'}, {u'title': u'Relating to the duties of certain law enforcement officials under procedures regulating the making or transfer of firearms.', u'created_at': datetime.datetime(2015, 2, 7, 1, 39, 5), u'updated_at': datetime.datetime(2016, 4, 28, 8, 31, 44), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00037069', u'bill_id': u'HB 1179'}, {u'title': u'Relating to the regulation of firearms, air guns, ammunition, and firearm and air gun supplies; imposing a civil penalty.', u'created_at': datetime.datetime(2015, 3, 15, 2, 11, 27), u'updated_at': datetime.datetime(2016, 4, 28, 8, 34, 37), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Campaign Finance and Election Issues', u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00044426', u'bill_id': u'HB 4061'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2015, 1, 7, 22, 6, 42), u'updated_at': datetime.datetime(2016, 4, 28, 8, 38, 58), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00035530', u'bill_id': u'HB 206'}, {u'title': u'Relating to an exemption from the sales tax for Firearms and Firearm supplies for a limited period.', u'created_at': datetime.datetime(2015, 1, 16, 0, 55, 12), u'updated_at': datetime.datetime(2016, 4, 28, 8, 34, 59), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00036092', u'bill_id': u'HB 712'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2015, 2, 22, 2, 33), u'updated_at': datetime.datetime(2016, 4, 28, 8, 34, 37), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00038243', u'bill_id': u'HB 1737'}, {u'title': u'Relating to reducing certain fees for licensed firearms dealers for a license to carry a concealed handgun.', u'created_at': datetime.datetime(2015, 3, 12, 21, 36, 3), u'updated_at': datetime.datetime(2016, 4, 28, 8, 36, 9), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Budget, Spending, and Taxes'], u'type': [u'bill'], u'id': u'TXB00042381', u'bill_id': u'HB 2958'}, {u'title': u'Relating to prohibiting certain physician questions regarding firearms.', u'created_at': datetime.datetime(2015, 3, 12, 21, 36, 44), u'updated_at': datetime.datetime(2016, 4, 28, 8, 37, 54), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'State Agencies', u'Health', u'Guns'], u'type': [u'bill'], u'id': u'TXB00042674', u'bill_id': u'HB 2823'}, {u'title': u"Relating to the storage of firearms surrendered by a person subject to a magistrate's order for emergency protection or protective order as a result of family violence, sexual assault or abuse, stalking, or trafficking of persons.", u'created_at': datetime.datetime(2015, 3, 10, 18, 20, 4), u'updated_at': datetime.datetime(2016, 4, 28, 8, 41, 3), u'chamber': u'lower', u'state': u'tx', u'session': u'84', u'subjects': [u'Social Issues', u'Municipal and County Issues', u'Family and Children Issues', u'Civil Liberties and Civil Rights', u'Other', u'Crime', u'Guns'], u'type': [u'bill'], u'id': u'TXB00041599', u'bill_id': u'HB 2409'}, {u'title': u'Relating to prohibiting public funds from being used to enforce certain federal or international laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2015, 2, 5, 1, 33, 49), u'updated_at': datetime.datetime(2015, 4, 14, 21, 38, 33), u'chamber': u'upper', u'state': u'tx', u'session': u'84', u'subjects': [u'Guns', u'Executive Branch', u'Crime'], u'type': [u'bill'], u'id': u'TXB00036899', u'bill_id': u'SB 438'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2013, 7, 3, 2, 45, 4), u'updated_at': datetime.datetime(2013, 7, 12, 2, 47, 18), u'chamber': u'lower', u'state': u'tx', u'session': u'832', u'subjects': [u'Campaign Finance and Election Issues', u'State Agencies', u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00034531', u'bill_id': u'HB 19'}, {u'title': u"Relating to requiring notice of a hotel's firearms policy and other guest policies; providing a criminal penalty.", u'created_at': datetime.datetime(2013, 1, 9, 0, 29, 40), u'updated_at': datetime.datetime(2013, 7, 1, 21, 40, 52), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Other', u'Business and Consumers', u'Guns', u'Technology and Communication'], u'type': [u'bill'], u'id': u'TXB00023768', u'bill_id': u'HB 333'}, {u'title': u'Relating to allowing the attorney general to obtain an injunction against a municipality or county that adopts prohibited regulations regarding firearms, ammunition, or firearm supplies.', u'created_at': datetime.datetime(2013, 3, 3, 4, 46, 49), u'updated_at': datetime.datetime(2013, 7, 1, 21, 25, 21), u'chamber': u'upper', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Municipal and County Issues', u'Executive Branch'], u'type': [u'bill'], u'id': u'TXB00027533', u'bill_id': u'SB 987'}, {u'title': u'Relating to the disposition of certain firearms seized by a law enforcement agency.', u'created_at': datetime.datetime(2013, 3, 12, 18, 24, 45), u'updated_at': datetime.datetime(2013, 7, 1, 21, 27, 35), u'chamber': u'upper', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00028327', u'bill_id': u'SB 1189'}, {u'title': u'Relating to the authority of certain retired peace officers and former reserve law enforcement officers to carry certain firearms.', u'created_at': datetime.datetime(2013, 3, 12, 19, 13, 17), u'updated_at': datetime.datetime(2013, 7, 1, 22, 2, 36), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00029859', u'bill_id': u'HB 3370'}, {u'title': u'Requesting the creation of a joint interim committee to study recruiting firearms and ammunition manufacturers to Texas.', u'created_at': datetime.datetime(2013, 3, 21, 7, 55, 18), u'updated_at': datetime.datetime(2013, 7, 1, 22, 7, 16), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Other', u'Business and Consumers', u'Guns', u'Legislative Affairs'], u'type': [u'concurrent resolution'], u'id': u'TXB00030780', u'bill_id': u'HCR 89'}, {u'title': u'Relating to the transportation and storage of firearms and ammunition by concealed handgun license holders in private vehicles on the campuses of certain institutions of higher education.', u'created_at': datetime.datetime(2013, 4, 25, 9, 53, 28), u'updated_at': datetime.datetime(2013, 7, 1, 21, 33, 48), u'chamber': u'upper', u'state': u'tx', u'session': u'83', u'subjects': [u'Education', u'Transportation', u'Guns'], u'type': [u'bill'], u'id': u'TXB00031814', u'bill_id': u'SB 1907'}, {u'title': u'Relating to certain firearms, firearm accessories, and firearm ammunition within the State of Texas; providing an exemption from federal regulation and providing penalties.', u'created_at': datetime.datetime(2013, 6, 4, 3, 57, 57), u'updated_at': datetime.datetime(2013, 6, 4, 3, 57, 57), u'chamber': u'lower', u'state': u'tx', u'session': u'831', u'subjects': [u'State Agencies', u'Guns', u'Executive Branch'], u'type': [u'bill'], u'id': u'TXB00033840', u'bill_id': u'HB 12'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2013, 6, 4, 3, 58), u'updated_at': datetime.datetime(2013, 6, 4, 3, 58), u'chamber': u'lower', u'state': u'tx', u'session': u'831', u'subjects': [u'Guns', u'Executive Branch', u'Crime'], u'type': [u'bill'], u'id': u'TXB00033843', u'bill_id': u'HB 15'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2013, 2, 6, 2, 32, 34), u'updated_at': datetime.datetime(2013, 5, 23, 11, 8, 48), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00025047', u'bill_id': u'HB 928'}, {u'title': u'Relating to certain firearms, firearm accessories, and firearm ammunition within the State of Texas; providing an exemption from federal regulation and providing penalties.', u'created_at': datetime.datetime(2013, 2, 13, 17, 55, 31), u'updated_at': datetime.datetime(2013, 5, 23, 11, 9, 53), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'State Agencies', u'Guns'], u'type': [u'bill'], u'id': u'TXB00025476', u'bill_id': u'HB 1076'}, {u'title': u'Relating to economic development incentives for firearms manufacturers, firearms accessory manufacturers, and ammunition manufacturers.', u'created_at': datetime.datetime(2013, 3, 12, 18, 31, 30), u'updated_at': datetime.datetime(2013, 5, 21, 11, 8, 35), u'chamber': u'upper', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Business and Consumers', u'Guns'], u'type': [u'bill'], u'id': u'TXB00028605', u'bill_id': u'SB 1467'}, {u'title': u'Relating to the transportation and storage of firearms and ammunition in private vehicles on the campuses of institutions of higher education.', u'created_at': datetime.datetime(2013, 2, 13, 17, 55, 32), u'updated_at': datetime.datetime(2013, 5, 15, 11, 0, 10), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Education', u'Transportation', u'Guns'], u'type': [u'bill'], u'id': u'TXB00025477', u'bill_id': u'HB 1077'}, {u'title': u'Relating to the authority of a political subdivision to prohibit the sale of firearms on public property in certain circumstances.', u'created_at': datetime.datetime(2013, 2, 13, 17, 54, 27), u'updated_at': datetime.datetime(2013, 5, 7, 10, 17, 24), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Campaign Finance and Election Issues', u'Public Services', u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00025430', u'bill_id': u'HB 1030'}, {u'title': u'Relating to the disposition of certain firearms seized by a law enforcement agency.', u'created_at': datetime.datetime(2013, 3, 12, 19, 19, 21), u'updated_at': datetime.datetime(2013, 5, 7, 10, 41, 48), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00030162', u'bill_id': u'HB 3673'}, {u'title': u'Relating to the collection and enforcement of sales and use taxes on imported firearms.', u'created_at': datetime.datetime(2013, 3, 12, 19, 10, 39), u'updated_at': datetime.datetime(2013, 4, 23, 9, 46, 32), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Guns', u'Budget, Spending, and Taxes'], u'type': [u'bill'], u'id': u'TXB00029767', u'bill_id': u'HB 3278'}, {u'title': u'Relating to a packaging notice for new firearms and firearm ammunition; imposing a criminal penalty.', u'created_at': datetime.datetime(2013, 2, 27, 17, 21, 9), u'updated_at': datetime.datetime(2013, 4, 21, 9, 17, 39), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Other', u'Business and Consumers', u'Guns'], u'type': [u'bill'], u'id': u'TXB00026871', u'bill_id': u'HB 1747'}, {u'title': u'Relating to requiring the attorney general to obtain an injunction against a municipality or county that adopts prohibited regulations regarding firearms, ammunition, or firearm supplies.', u'created_at': datetime.datetime(2013, 3, 12, 19, 0, 6), u'updated_at': datetime.datetime(2013, 4, 19, 16, 11, 32), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Municipal and County Issues', u'Executive Branch'], u'type': [u'bill'], u'id': u'TXB00029349', u'bill_id': u'HB 2860'}, {u'title': u'Relating to the carrying of firearms by certain off-duty employees of the Texas Department of Criminal Justice and the carrying of a handgun by a license holder in certain locations; authorizing a fee.', u'created_at': datetime.datetime(2013, 3, 12, 19, 14, 19), u'updated_at': datetime.datetime(2013, 4, 13, 9, 48, 43), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'State Agencies', u'Education', u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00029909', u'bill_id': u'HB 3420'}, {u'title': u'Relating to an education program for firearms sellers regarding mental health and immunity from civil liability for certain actions.', u'created_at': datetime.datetime(2013, 3, 12, 19, 20, 25), u'updated_at': datetime.datetime(2013, 3, 24, 8, 28, 53), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'State Agencies', u'Health', u'Guns'], u'type': [u'bill'], u'id': u'TXB00030230', u'bill_id': u'HB 3741'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2013, 3, 12, 18, 25, 36), u'updated_at': datetime.datetime(2013, 3, 21, 7, 36, 51), u'chamber': u'upper', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00028366', u'bill_id': u'SB 1228'}, {u'title': u'Relating to firearms and the preservation of the Second Amendment to the United States Constitution; providing penalties.', u'created_at': datetime.datetime(2013, 1, 17, 0, 54, 35), u'updated_at': datetime.datetime(2013, 7, 1, 21, 42, 24), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Legislative Affairs', u'Public Services', u'Crime', u'Labor and Employment', u'State Agencies', u'Guns'], u'type': [u'bill'], u'id': u'TXB00024156', u'bill_id': u'HB 553'}, {u'title': u'Relating to the enforcement of certain federal laws regulating firearms, firearm accessories, and firearm ammunition within the State of Texas.', u'created_at': datetime.datetime(2013, 2, 13, 17, 54, 53), u'updated_at': datetime.datetime(2013, 3, 28, 8, 22, 43), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Guns', u'Executive Branch'], u'type': [u'bill'], u'id': u'TXB00025449', u'bill_id': u'HB 1049'}, {u'title': u'Relating to an exemption from the sales tax for firearms and hunting supplies for a limited period.', u'created_at': datetime.datetime(2013, 2, 22, 3, 54, 55), u'updated_at': datetime.datetime(2013, 5, 7, 10, 22), u'chamber': u'lower', u'state': u'tx', u'session': u'83', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00026398', u'bill_id': u'HB 1533'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2011, 1, 11, 18, 41, 27), u'updated_at': datetime.datetime(2012, 7, 10, 3, 43, 8), u'chamber': u'upper', u'state': u'tx', u'session': u'82', u'subjects': [u'Labor and Employment', u'Transportation', u'Guns'], u'type': [u'bill'], u'id': u'TXB00012711', u'bill_id': u'SB 321'}, {u'title': u'Relating to the liability of a sport shooting range and the regulation of firearms, ammunition, firearm supplies, and sport shooting ranges.', u'created_at': datetime.datetime(2011, 2, 19, 3, 47, 43), u'updated_at': datetime.datetime(2012, 7, 10, 3, 43, 17), u'chamber': u'upper', u'state': u'tx', u'session': u'82', u'subjects': [u'Recreation', u'Legal Issues', u'Municipal and County Issues', u'Guns'], u'type': [u'bill'], u'id': u'TXB00015458', u'bill_id': u'SB 766'}, {u'title': u'Relating to the municipal regulation of the discharge of firearms and certain other weapons in certain counties.', u'created_at': datetime.datetime(2011, 3, 5, 5, 46, 7), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 36), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00016957', u'bill_id': u'HB 2127'}, {u'title': u'Relating to the liability of a sport shooting range and the regulation of firearms, ammunition, firearm supplies, and sport shooting ranges.', u'created_at': datetime.datetime(2011, 2, 23, 4, 11, 35), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 27), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Recreation', u'Legal Issues', u'Municipal and County Issues', u'Guns'], u'type': [u'bill'], u'id': u'TXB00015747', u'bill_id': u'HB 1595'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2011, 1, 20, 1, 32, 35), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 14), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00013632', u'bill_id': u'HB 681'}, {u'title': u'Relating to exemptions from the sales tax for certain firearms, hunting equipment, ammunition, and firearm or hunting accessories for a limited period.', u'created_at': datetime.datetime(2011, 3, 11, 6, 53, 33), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 48), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00018086', u'bill_id': u'HB 2782'}, {u'title': u'Relating to exemptions from the sales tax for certain firearms, hunting equipment, ammunition, and firearm or hunting accessories for a limited period.', u'created_at': datetime.datetime(2011, 3, 12, 7, 36, 24), u'updated_at': datetime.datetime(2012, 7, 10, 3, 43, 30), u'chamber': u'upper', u'state': u'tx', u'session': u'82', u'subjects': [u'Commerce', u'Animal Rights and Wildlife Issues', u'Budget, Spending, and Taxes', u'Guns'], u'type': [u'bill'], u'id': u'TXB00018137', u'bill_id': u'SB 1411'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2011, 3, 12, 7, 36, 35), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 49), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Labor and Employment', u'State Agencies', u'Guns'], u'type': [u'bill'], u'id': u'TXB00018377', u'bill_id': u'HB 2890'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2011, 1, 31, 17, 20, 5), u'updated_at': datetime.datetime(2012, 7, 10, 3, 44, 18), u'chamber': u'lower', u'state': u'tx', u'session': u'82', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00014179', u'bill_id': u'HB 954'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2010, 6, 16, 14, 50, 51), u'updated_at': datetime.datetime(2012, 7, 11, 4, 40, 44), u'chamber': u'upper', u'state': u'tx', u'session': u'811', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00002588', u'bill_id': u'SB 13'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2010, 6, 16, 14, 54, 34), u'updated_at': datetime.datetime(2012, 7, 11, 4, 40, 44), u'chamber': u'lower', u'state': u'tx', u'session': u'811', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00007435', u'bill_id': u'HB 12'}, {u'title': u'Relating to the authority of certain juvenile probation officers to carry firearms.', u'created_at': datetime.datetime(2010, 6, 16, 14, 49, 56), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 18), u'chamber': u'upper', u'state': u'tx', u'session': u'81', u'subjects': [u'State Agencies', u'Guns', u'Family and Children Issues', u'Crime'], u'type': [u'bill'], u'id': u'TXB00001232', u'bill_id': u'SB 1237'}, {u'title': u'Relating to the regulation of the discharge of firearms and certain other weapons by certain municipalities.', u'created_at': datetime.datetime(2010, 6, 16, 14, 50, 16), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 23), u'chamber': u'upper', u'state': u'tx', u'session': u'81', u'subjects': [u'Housing and Property', u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00001737', u'bill_id': u'SB 1742'}, {u'title': u'Relating to the interstate purchase of certain firearms.', u'created_at': datetime.datetime(2010, 6, 16, 14, 49, 54), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 18), u'chamber': u'upper', u'state': u'tx', u'session': u'81', u'subjects': [u'Guns'], u'type': [u'bill'], u'id': u'TXB00001183', u'bill_id': u'SB 1188'}, {u'title': u'Relating to the requirement that certain state and local governmental entities designate a firearms proficiency officer and require weapons proficiency.', u'created_at': datetime.datetime(2010, 6, 16, 14, 49, 58), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 19), u'chamber': u'upper', u'state': u'tx', u'session': u'81', u'subjects': [u'Public Services', u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00001298', u'bill_id': u'SB 1303'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2010, 6, 16, 14, 49, 36), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 13), u'chamber': u'upper', u'state': u'tx', u'session': u'81', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00000725', u'bill_id': u'SB 730'}, {u'title': u'Relating to the requirement that certain state and local governmental entities designate a firearms proficiency officer and require weapons proficiency.', u'created_at': datetime.datetime(2010, 6, 16, 14, 52, 54), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52, 19), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'Public Services', u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00005466', u'bill_id': u'HB 2870'}, {u'title': u'Relating to the interstate purchase of certain firearms.', u'created_at': datetime.datetime(2010, 6, 16, 14, 51, 2), u'updated_at': datetime.datetime(2012, 7, 10, 23, 51, 50), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'Guns'], u'type': [u'bill'], u'id': u'TXB00002863', u'bill_id': u'HB 267'}, {u'title': u'Relating to the authority of certain juvenile probation officers to carry firearms.', u'created_at': datetime.datetime(2010, 6, 16, 14, 52, 31), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52, 14), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'State Agencies', u'Guns', u'Family and Children Issues', u'Crime'], u'type': [u'bill'], u'id': u'TXB00004974', u'bill_id': u'HB 2378'}, {u'title': u'Relating to the authority of certain county jail guards to carry firearms.', u'created_at': datetime.datetime(2010, 6, 16, 14, 52, 50), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52, 18), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'State Agencies', u'Guns', u'Crime'], u'type': [u'bill'], u'id': u'TXB00005387', u'bill_id': u'HB 2791'}, {u'title': u'Relating to the discharge of firearms in certain navigable rivers or streams.', u'created_at': datetime.datetime(2010, 6, 16, 14, 54, 2), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52, 30), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'Environmental', u'Public Services', u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00006883', u'bill_id': u'HB 4287'}, {u'title': u'Relating to municipal regulation of the discharge of firearms and certain other weapons.', u'created_at': datetime.datetime(2010, 6, 16, 14, 53, 36), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52, 26), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'Housing and Property', u'Guns', u'Municipal and County Issues'], u'type': [u'bill'], u'id': u'TXB00006362', u'bill_id': u'HB 3766'}, {u'title': u"Relating to an employee's transportation and storage of certain firearms or ammunition while on certain property owned or controlled by the employee's employer.", u'created_at': datetime.datetime(2010, 6, 16, 14, 51, 44), u'updated_at': datetime.datetime(2012, 7, 10, 23, 52), u'chamber': u'lower', u'state': u'tx', u'session': u'81', u'subjects': [u'Labor and Employment', u'Guns'], u'type': [u'bill'], u'id': u'TXB00003897', u'bill_id': u'HB 1301'}]

In [10]:
bill_count_by_state = {}

for state in states:
    bill_count_by_state[state] = len(us_bills[state])
    
print(bill_count_by_state)


{u'va': 223, u'co': 10, u'ca': 173, u'al': 68, u'ar': 13, u'vt': 26, u'il': 237, u'ga': 54, u'in': 23, u'ia': 41, u'az': 84, u'id': 13, u'ct': 62, u'nh': 37, u'nj': 253, u'nm': 18, u'tx': 76, u'la': 80, u'nc': 28, u'nd': 12, u'ne': 23, u'tn': 305, u'ny': 329, u'pa': 273, u'ak': 12, u'nv': 41, u'pr': 0, u'wa': 71, u'de': 19, u'dc': 12, u'wi': 40, u'wv': 90, u'hi': 109, u'ok': 236, u'fl': 112, u'wy': 7, u'me': 36, u'md': 164, u'ma': 63, u'oh': 29, u'ut': 11, u'mo': 97, u'mn': 91, u'mi': 115, u'ri': 67, u'ks': 28, u'mt': 18, u'ms': 84, u'sc': 74, u'ky': 76, u'or': 50, u'sd': 24}

In [13]:
values = bill_count_by_state.values()
values.sort()

print(values)

total_bills = 0

for value in values:
    total_bills = total_bills + value
    
print(total_bills)


[0, 7, 10, 11, 12, 12, 12, 13, 13, 18, 18, 19, 23, 23, 24, 26, 28, 28, 29, 36, 37, 40, 41, 41, 50, 54, 62, 63, 67, 68, 71, 74, 76, 76, 80, 84, 84, 90, 91, 97, 109, 112, 115, 164, 173, 223, 236, 237, 253, 273, 305, 329]
4237

In [1]:
import vincent


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-fb12cdc60b1d> in <module>()
----> 1 import vincent

ImportError: No module named vincent

In [ ]: