Skip to content

Commit 749c6ae

Browse files
committed
Need to fix unicode in order for all legislators to print successfully
1 parent 6cf5b7a commit 749c6ae

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Students/SSchwafel/Project/InformedVoter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#legislators = json.load(urllib2.urlopen('https://congress.api.sunlightfoundation.com/legislators?chamber=house&per_page=all&apikey=15f4679bdc124cd6a2c6be8666253000'.format(user_lat, user_long)))
3939

4040
#All Legislators
41-
#legislators = json.load(urllib2.urlopen('https://congress.api.sunlightfoundation.com/legislators?per_page=all&apikey=15f4679bdc124cd6a2c6be8666253000'.format(user_lat, user_long)))
41+
legislators = json.load(urllib2.urlopen('https://congress.api.sunlightfoundation.com/legislators?per_page=all&apikey=15f4679bdc124cd6a2c6be8666253000'.format(user_lat, user_long)))
4242

4343
#pprint(senators['results'])
4444
#print 'Based on the latitude and longitude provided, your United States Congresspeople are: \n'
@@ -56,7 +56,7 @@ def find_legislators():
5656

5757
#votes_url = json.load(urllib2.urlopen('https://congress.api.sunlightfoundation.com/votes?voter_ids.{}__exists=true&apikey=15f4679bdc124cd6a2c6be8666253000')).format( __ THIS IS WHERE THE UNIQUE ID OF THE LEGISLATOR NEEDS TO BE __ )
5858

59-
pprint(votes_url)
59+
#pprint(votes_url)
6060

6161
#def recent_votes():
6262

@@ -65,10 +65,14 @@ def find_legislators():
6565
def print_legislators():
6666

6767
#FIX THE FORMATTING BELOW!!!
68+
#Also, be sure to add .encode('utf-8')
6869

6970
for i in legislators['results']:
7071
if i['chamber'] == 'house' and i['gender'] == 'M':
7172
print 'Congressman ' + i['first_name'] + ' ' + i['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
73+
if i['chamber'] == 'house' and i['gender'] == 'F':
74+
print 'Congresswoman ' + i['first_name'] + ' ' + i['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
7275
elif i['chamber'] == 'senate':
7376
print 'Senator ' + i['first_name'] + ' ' + i ['last_name'] + ' - ' + i['party']+ '\n' + 'Phone: ' + i['phone'] + '\n' + 'Website: ' + i['website'] + '\n'
7477

78+
print_legislators()

0 commit comments

Comments
 (0)