Find file
Fetching contributors…
Cannot retrieve contributors at this time
571 lines (322 sloc) 18.6 KB

The Associated Press client

Retrieving data

The AP client is public class you can use to connect to the AP's data feed.

Election result collections

Depending on which client method you use to harvest data, results may be returned as State or TopOfTicket objects. Don't worry about the distinction, because they act pretty much the same. They share the following attributes for you to use.


A contest being decided by voters choosing between candidates. This object is the key to everything about it. It is often found in the races attribute of a result collection.

Reporting units

An area or unit that groups votes into a total. For instance, a state, a congressional district, a county.


A choice for voters in a race. In the presidential race, a person, like Barack Obama. In a ballot measure, a direction, like Yes or No.


The vote count for a candidate in a race in a particular reporting unit.

Presidential summary collections

Calling presidential methods, like get_presidential_summary will return a slightly different, and simpler, result collection.

Delegate summary collections

Calling delegate related methods, like get_delegate_summary will return a slightly different, and simpler, result collection. To start, you should receive a list containing two Nomination objects.


A contest to be the presidential nominee of one of the two major parties.

State delegations

A state's delegation and who they choose to be a party's presidential nominee.