def download(country, legislature, destination):
    """
    download current info from ep to file
    """
    ep = EveryPolitician()
    country, leg = ep.country_legislature(country, legislature)
    url = leg.popolo_url
    js = requests.get(url).content
    with open(destination, 'w') as f:
        f.write(js)
 def test_get_a_country_legislature_neither_found(self,
                                                  patched_requests_get):
     ep = EveryPolitician()
     with pytest.raises(NotFound):
         ep.country_legislature('FOO', 'FOO')
 def test_get_a_country_and_legislature(self, patched_requests_get):
     ep = EveryPolitician()
     country, legislature = ep.country_legislature('Argentina', 'Diputados')
     assert country.name == 'Argentina'
     assert legislature.name == 'Cámara de Diputados'