示例#1
0
 def testCommitteeSearch(self):
     """Committee search"""
     state = "dc"
     results = pyopenstates.search_committees(state=state)
     self.assertGreater(len(results), 2)
     for committee in results:
         self.assertEqual(committee["state"], state.lower())
示例#2
0
 def handle_search_committees_intent(self, message):
     search = message.data.get("State").capitalize()
     name_to_abbr = us.states.mapping('name', 'abbr')
     name = name_to_abbr[search]
     response = pyopenstates.search_committees(state=name)
     for i in response:
         self.speak(i['committee'])
示例#3
0
 def query(self, type='all'):
     Tables.query(self)
     committees = pyopenstates.search_committees(state=config.STATE)
     self.raw_dictionary = map(
         lambda comm_dic: pyopenstates.get_committee(
             comm_dic['id'],
             fields=[
                 'id', 'chamber', 'sources', 'subcommittee', 'committee',
                 'parent_id'
             ]), committees)
示例#4
0
from MnHouseMemAdditionalInfo import process_text, parse_info, get_member

apiKey = 'd2c0db7e-6a6e-4606-a9b0-83c18e647ff6'
state = raw_input("Which state? ")
# state = sys.argv[1]
pyopenstates.set_api_key(apiKey)


DIGISTATE = dx_State.objects.get(state_name__code=state)
HOUSE, c1 = Org.objects.get_or_create(name="MN House of Representative",
                                      digistate=DIGISTATE)
SENATE, c2 = Org.objects.get_or_create(name="MN State Senate",
                                       digistate=DIGISTATE)

cmts = pyopenstates.search_committees(state=state)
reps = pyopenstates.search_legislators(state=state)
districts_lower = pyopoenstates.search_districts(state=state, chamber="lower")
#districts_upper = pyopenstates.search_districts(state=state, chamber="upper")
bills_upper = pyopenstates.search_bills(state=state, chamber="upper", updated_since="2017-01-01")
bills_lower = pyopenstates.search_bills(state=state, chamber="lower", updated_since="2017-01-01")



for bill in bills_upper:
    number = bill['bill_id']
    intro = bill['title']
    status = bill['id']
#    try:
    nbill, create = PolicyRecord.objects.get_or_create(number=number,
                                                       intro_text=intro[:512],