Example #1
0
from congress import ElectedOfficial

# e = ElectedOfficial()
# e.parties

assert ["D", "R", "I"] == ElectedOfficial.parties

# if you see the name of the class on the left of the dot, then you don't need to specify what its passing in
# basically, for class level stuff, you don't need "self"
# for instance level, you need "self"
representatives = ElectedOfficial.get_all()
assert type(representatives) is list
assert 442 == len(representatives)

illinois_delegation = ElectedOfficial.get_all_from_state("IL")
assert type(illinois_delegation) is list
assert 18 == len(illinois_delegation)
assert "IL" == illinois_delegation[0].state
print("AWESOME")
Example #2
0
from congress import ElectedOfficial

assert ["D", "R", "I"] == ElectedOfficial.parties


representatives = ElectedOfficial.get_all()
assert type(representatives) is list
assert 442 == len(representatives)

illinois_delegation = ElectedOfficial.get_all_from_state("IL")
assert type(illinois_delegation) is list
assert 18 == len(illinois_delegation)
Example #3
0
data = {
    "id": "D000622",
    "thomas_id": "2123",
    "api_uri":
    "http://api.nytimes.com/svc/politics/v3/us/legislative/congress/members/D000622.json",
    "first_name": "Tammy",
    "middle_name": None,
    "last_name": "Duckworth",
    "party": "D",
    "twitter_account": "RepDuckworth",
    "facebook_account": "CongresswomanTammyDuckworth",
    "facebook_id": "112300955610529",
    "url": "http://duckworth.house.gov",
    "rss_url": "http://duckworth.house.gov/rss.xml",
    "domain": "duckworth.house.gov",
    "dw_nominate": "-0.274",
    "ideal_point": "-0.680333034",
    "seniority": "2",
    "state": "IL",
    "district": "8",
    "missed_votes_pct": "6.54",
    "votes_with_party_pct": "89.41"
}

rep_duckworth = ElectedOfficial(data)

assert rep_duckworth.party == 'D'
assert rep_duckworth.loyalty_factor == 89.41

print("All assertions passed!")
from congress import ElectedOfficial

assert ["D", "R", "I"] == ElectedOfficial.parties

# representatives = ElectedOfficial.get_all()
# assert type(representatives) is list
# assert 442 == len(representatives)

illinois_delegation = ElectedOfficial.get_all_from_state("IL")
assert type(illinois_delegation) is list
assert 18 == len(illinois_delegation)

print(illinois_delegation)