elex.api.Elections

class elex.api.Elections

Holds a collection of election objects

get_elections(datafile=None)

Get election data from API or cached file.

Parameters:datafile – If datafile is specified, use instead of making an API call.
get_next_election(datafile=None, electiondate=None)

Get next election. By default, will be relative to the current date.

Parameters:
  • datafile – If datafile is specified, use instead of making an API call.
  • electiondate – If electiondate is specified, gets the next election after the specified date.