This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
party_counts = sorted([ | |
{'party': p, 'count': get_party_count(p, session)} for p in parties], | |
key=lambda x: x['count']) | |
pprint(party_counts) | |
all_people = politicians + executives | |
politician_counts = sorted([ | |
{'politician': p, 'count': get_politician_count(p, session)} for p in all_people], | |
key=lambda x: x['count']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
NPO_BACKSTAGE_BASE_URL = 'http://backstage-api.npo.nl' | |
NPO_BACKSTAGE_ENDPOINT_SEARCH = '/v0/search' | |
def get_politician_count(politician, session): | |
SEARCH_DATA = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
from BeautifulSoup import BeautifulSoup | |
def get_politicians(session): | |
url = u'http://www.tweedekamer.nl/kamerleden/alle_kamerleden' | |
resp = session.get(url) | |
if resp.status_code != 200: | |
return None |
NewerOlder