Google Civic Information API . elections

Instance Methods

close()

Close httplib2 connections.

electionQuery(productionDataOnly=None, x__xgafv=None)

List of available elections to query.

voterInfoQuery(address, electionId=None, officialOnly=None, productionDataOnly=None, returnAllAvailableData=None, x__xgafv=None)

Looks up information relevant to a voter based on the voter's registered address.

Method Details

close()
Close httplib2 connections.
electionQuery(productionDataOnly=None, x__xgafv=None)
List of available elections to query.

Args:
  productionDataOnly: boolean, Whether to include data that has not been allowlisted yet
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The list of elections available for this version of the API.
  "elections": [ # A list of available elections
    { # Information about the election that was queried.
      "electionDay": "A String", # Day of the election in YYYY-MM-DD format.
      "id": "A String", # The unique ID of this election.
      "name": "A String", # A displayable name for the election.
      "ocdDivisionId": "A String", # The political division of the election. Represented as an OCD Division ID. Voters within these political jurisdictions are covered by this election. This is typically a state such as ocd-division/country:us/state:ca or for the midterms or general election the entire US (i.e. ocd-division/country:us).
      "shapeLookupBehavior": "A String",
    },
  ],
  "kind": "civicinfo#electionsQueryResponse", # Identifies what kind of resource this is. Value: the fixed string "civicinfo#electionsQueryResponse".
}
voterInfoQuery(address, electionId=None, officialOnly=None, productionDataOnly=None, returnAllAvailableData=None, x__xgafv=None)
Looks up information relevant to a voter based on the voter's registered address.

Args:
  address: string, The registered address of the voter to look up. (required)
  electionId: string, The unique ID of the election to look up. A list of election IDs can be obtained at https://www.googleapis.com/civicinfo/{version}/elections. If no election ID is specified in the query and there is more than one election with data for the given voter, the additional elections are provided in the otherElections response field.
  officialOnly: boolean, If set to true, only data from official state sources will be returned.
  productionDataOnly: boolean, Whether to include data that has not been vetted yet. Should only be made available to internal IPs or trusted partners. This is a non-discoverable parameter in the One Platform API config.
  returnAllAvailableData: boolean, If set to true, the query will return the success code and include any partial information when it is unable to determine a matching address or unable to determine the election for electionId=0 queries.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # The result of a voter info lookup query.
  "contests": [ # Contests that will appear on the voter's ballot.
    { # Information about a contest that appears on a voter's ballot.
      "ballotPlacement": "A String", # A number specifying the position of this contest on the voter's ballot.
      "ballotTitle": "A String", # The official title on the ballot for this contest, only where available.
      "candidates": [ # The candidate choices for this contest.
        { # Information about a candidate running for elected office.
          "candidateUrl": "A String", # The URL for the candidate's campaign web site.
          "channels": [ # A list of known (social) media channels for this candidate.
            { # A social media or web channel for a candidate.
              "id": "A String", # The unique public identifier for the candidate's channel.
              "type": "A String", # The type of channel. The following is a list of types of channels, but is not exhaustive. More channel types may be added at a later time. One of: GooglePlus, YouTube, Facebook, Twitter
            },
          ],
          "email": "A String", # The email address for the candidate's campaign.
          "name": "A String", # The candidate's name. If this is a joint ticket it will indicate the name of the candidate at the top of a ticket followed by a / and that name of candidate at the bottom of the ticket. e.g. "Mitt Romney / Paul Ryan"
          "orderOnBallot": "A String", # The order the candidate appears on the ballot for this contest.
          "party": "A String", # The full name of the party the candidate is a member of.
          "phone": "A String", # The voice phone number for the candidate's campaign office.
          "photoUrl": "A String", # A URL for a photo of the candidate.
        },
      ],
      "district": { # Describes the geographic scope of a contest. # Information about the electoral district that this contest is in.
        "id": "A String", # An identifier for this district, relative to its scope. For example, the 34th State Senate district would have id "34" and a scope of stateUpper.
        "name": "A String", # The name of the district.
        "scope": "A String", # The geographic scope of this district. If unspecified the district's geography is not known. One of: national, statewide, congressional, stateUpper, stateLower, countywide, judicial, schoolBoard, cityWide, township, countyCouncil, cityCouncil, ward, special
      },
      "electorateSpecifications": "A String", # A description of any additional eligibility requirements for voting in this contest.
      "level": [ # The levels of government of the office for this contest. There may be more than one in cases where a jurisdiction effectively acts at two different levels of government; for example, the mayor of the District of Columbia acts at "locality" level, but also effectively at both "administrative-area-2" and "administrative-area-1".
        "A String",
      ],
      "numberElected": "A String", # The number of candidates that will be elected to office in this contest.
      "numberVotingFor": "A String", # The number of candidates that a voter may vote for in this contest.
      "office": "A String", # The name of the office for this contest.
      "primaryParties": [ # If this is a partisan election, the name of the party/parties it is for.
        "A String",
      ],
      "referendumBallotResponses": [ # The set of ballot responses for the referendum. A ballot response represents a line on the ballot. Common examples might include "yes" or "no" for referenda. This field is only populated for contests of type 'Referendum'.
        "A String",
      ],
      "referendumBrief": "A String", # Specifies a short summary of the referendum that is typically on the ballot below the title but above the text. This field is only populated for contests of type 'Referendum'.
      "referendumConStatement": "A String", # A statement in opposition to the referendum. It does not necessarily appear on the ballot. This field is only populated for contests of type 'Referendum'.
      "referendumEffectOfAbstain": "A String", # Specifies what effect abstaining (not voting) on the proposition will have (i.e. whether abstaining is considered a vote against it). This field is only populated for contests of type 'Referendum'.
      "referendumPassageThreshold": "A String", # The threshold of votes that the referendum needs in order to pass, e.g. "two-thirds". This field is only populated for contests of type 'Referendum'.
      "referendumProStatement": "A String", # A statement in favor of the referendum. It does not necessarily appear on the ballot. This field is only populated for contests of type 'Referendum'.
      "referendumSubtitle": "A String", # A brief description of the referendum. This field is only populated for contests of type 'Referendum'.
      "referendumText": "A String", # The full text of the referendum. This field is only populated for contests of type 'Referendum'.
      "referendumTitle": "A String", # The title of the referendum (e.g. 'Proposition 42'). This field is only populated for contests of type 'Referendum'.
      "referendumUrl": "A String", # A link to the referendum. This field is only populated for contests of type 'Referendum'.
      "roles": [ # The roles which this office fulfills.
        "A String",
      ],
      "sources": [ # A list of sources for this contest. If multiple sources are listed, the data has been aggregated from those sources.
        { # Contains information about the data source for the element containing it.
          "name": "A String", # The name of the data source.
          "official": True or False, # Whether this data comes from an official government source.
        },
      ],
      "special": "A String", # "Yes" or "No" depending on whether this a contest being held outside the normal election cycle.
      "type": "A String", # The type of contest. Usually this will be 'General', 'Primary', or 'Run-off' for contests with candidates. For referenda this will be 'Referendum'. For Retention contests this will typically be 'Retention'.
    },
  ],
  "dropOffLocations": [ # Locations where a voter is eligible to drop off a completed ballot. The voter must have received and completed a ballot prior to arriving at the location. The location may not have ballots available on the premises. These locations could be open on or before election day as indicated in the pollingHours field.
    { # A location where a voter can vote. This may be an early vote site, an election day voting location, or a drop off location for a completed ballot.
      "address": { # A simple representation of an address. # The address of the location.
        "city": "A String", # The city or town for the address.
        "line1": "A String", # The street name and number of this address.
        "line2": "A String", # The second line the address, if needed.
        "line3": "A String", # The third line of the address, if needed.
        "locationName": "A String", # The name of the location.
        "state": "A String", # The US two letter state abbreviation of the address.
        "zip": "A String", # The US Postal Zip Code of the address.
      },
      "endDate": "A String", # The last date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "latitude": 3.14, # Latitude of the location, in degrees north of the equator. Note this field may not be available for some locations.
      "longitude": 3.14, # Longitude of the location, in degrees east of the Prime Meridian. Note this field may not be available for some locations.
      "name": "A String", # The name of the early vote site or drop off location. This field is not populated for polling locations.
      "notes": "A String", # Notes about this location (e.g. accessibility ramp or entrance to use).
      "pollingHours": "A String", # A description of when this location is open.
      "sources": [ # A list of sources for this location. If multiple sources are listed the data has been aggregated from those sources.
        { # Contains information about the data source for the element containing it.
          "name": "A String", # The name of the data source.
          "official": True or False, # Whether this data comes from an official government source.
        },
      ],
      "startDate": "A String", # The first date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "voterServices": "A String", # The services provided by this early vote site or drop off location. This field is not populated for polling locations.
    },
  ],
  "earlyVoteSites": [ # Locations where the voter is eligible to vote early, prior to election day.
    { # A location where a voter can vote. This may be an early vote site, an election day voting location, or a drop off location for a completed ballot.
      "address": { # A simple representation of an address. # The address of the location.
        "city": "A String", # The city or town for the address.
        "line1": "A String", # The street name and number of this address.
        "line2": "A String", # The second line the address, if needed.
        "line3": "A String", # The third line of the address, if needed.
        "locationName": "A String", # The name of the location.
        "state": "A String", # The US two letter state abbreviation of the address.
        "zip": "A String", # The US Postal Zip Code of the address.
      },
      "endDate": "A String", # The last date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "latitude": 3.14, # Latitude of the location, in degrees north of the equator. Note this field may not be available for some locations.
      "longitude": 3.14, # Longitude of the location, in degrees east of the Prime Meridian. Note this field may not be available for some locations.
      "name": "A String", # The name of the early vote site or drop off location. This field is not populated for polling locations.
      "notes": "A String", # Notes about this location (e.g. accessibility ramp or entrance to use).
      "pollingHours": "A String", # A description of when this location is open.
      "sources": [ # A list of sources for this location. If multiple sources are listed the data has been aggregated from those sources.
        { # Contains information about the data source for the element containing it.
          "name": "A String", # The name of the data source.
          "official": True or False, # Whether this data comes from an official government source.
        },
      ],
      "startDate": "A String", # The first date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "voterServices": "A String", # The services provided by this early vote site or drop off location. This field is not populated for polling locations.
    },
  ],
  "election": { # Information about the election that was queried. # The election that was queried.
    "electionDay": "A String", # Day of the election in YYYY-MM-DD format.
    "id": "A String", # The unique ID of this election.
    "name": "A String", # A displayable name for the election.
    "ocdDivisionId": "A String", # The political division of the election. Represented as an OCD Division ID. Voters within these political jurisdictions are covered by this election. This is typically a state such as ocd-division/country:us/state:ca or for the midterms or general election the entire US (i.e. ocd-division/country:us).
    "shapeLookupBehavior": "A String",
  },
  "kind": "civicinfo#voterInfoResponse", # Identifies what kind of resource this is. Value: the fixed string "civicinfo#voterInfoResponse".
  "mailOnly": True or False, # Specifies whether voters in the precinct vote only by mailing their ballots (with the possible option of dropping off their ballots as well).
  "normalizedInput": { # A simple representation of an address. # The normalized version of the requested address
    "city": "A String", # The city or town for the address.
    "line1": "A String", # The street name and number of this address.
    "line2": "A String", # The second line the address, if needed.
    "line3": "A String", # The third line of the address, if needed.
    "locationName": "A String", # The name of the location.
    "state": "A String", # The US two letter state abbreviation of the address.
    "zip": "A String", # The US Postal Zip Code of the address.
  },
  "otherElections": [ # When there are multiple elections for a voter address, the otherElections field is populated in the API response and there are two possibilities: 1. If the earliest election is not the intended election, specify the election ID of the desired election in a second API request using the electionId field. 2. If these elections occur on the same day, the API doesn?t return any polling location, contest, or election official information to ensure that an additional query is made. For user-facing applications, we recommend displaying these elections to the user to disambiguate. A second API request using the electionId field should be made for the election that is relevant to the user.
    { # Information about the election that was queried.
      "electionDay": "A String", # Day of the election in YYYY-MM-DD format.
      "id": "A String", # The unique ID of this election.
      "name": "A String", # A displayable name for the election.
      "ocdDivisionId": "A String", # The political division of the election. Represented as an OCD Division ID. Voters within these political jurisdictions are covered by this election. This is typically a state such as ocd-division/country:us/state:ca or for the midterms or general election the entire US (i.e. ocd-division/country:us).
      "shapeLookupBehavior": "A String",
    },
  ],
  "pollingLocations": [ # Locations where the voter is eligible to vote on election day.
    { # A location where a voter can vote. This may be an early vote site, an election day voting location, or a drop off location for a completed ballot.
      "address": { # A simple representation of an address. # The address of the location.
        "city": "A String", # The city or town for the address.
        "line1": "A String", # The street name and number of this address.
        "line2": "A String", # The second line the address, if needed.
        "line3": "A String", # The third line of the address, if needed.
        "locationName": "A String", # The name of the location.
        "state": "A String", # The US two letter state abbreviation of the address.
        "zip": "A String", # The US Postal Zip Code of the address.
      },
      "endDate": "A String", # The last date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "latitude": 3.14, # Latitude of the location, in degrees north of the equator. Note this field may not be available for some locations.
      "longitude": 3.14, # Longitude of the location, in degrees east of the Prime Meridian. Note this field may not be available for some locations.
      "name": "A String", # The name of the early vote site or drop off location. This field is not populated for polling locations.
      "notes": "A String", # Notes about this location (e.g. accessibility ramp or entrance to use).
      "pollingHours": "A String", # A description of when this location is open.
      "sources": [ # A list of sources for this location. If multiple sources are listed the data has been aggregated from those sources.
        { # Contains information about the data source for the element containing it.
          "name": "A String", # The name of the data source.
          "official": True or False, # Whether this data comes from an official government source.
        },
      ],
      "startDate": "A String", # The first date that this early vote site or drop off location may be used. This field is not populated for polling locations.
      "voterServices": "A String", # The services provided by this early vote site or drop off location. This field is not populated for polling locations.
    },
  ],
  "precinctId": "A String",
  "precincts": [ # The precincts that match this voter's address. Will only be returned for project IDs which have been allowlisted as "partner projects".
    {
      "administrationRegionId": "A String", # ID of the AdministrationRegion message for this precinct. Corresponds to LocalityId xml tag.
      "contestId": [ # ID(s) of the Contest message(s) for this precinct.
        "A String",
      ],
      "datasetId": "A String", # Required. Dataset ID. What datasets our Precincts come from.
      "earlyVoteSiteId": [ # ID(s) of the PollingLocation message(s) for this precinct.
        "A String",
      ],
      "electoralDistrictId": [ # ID(s) of the ElectoralDistrict message(s) for this precinct.
        "A String",
      ],
      "id": "A String", # Required. A unique identifier for this precinct.
      "mailOnly": True or False, # Specifies if the precinct runs mail-only elections.
      "name": "A String", # Required. The name of the precinct.
      "number": "A String", # The number of the precinct.
      "ocdId": [ # Encouraged. The OCD ID of the precinct
        "A String",
      ],
      "pollingLocationId": [ # ID(s) of the PollingLocation message(s) for this precinct.
        "A String",
      ],
      "spatialBoundaryId": [ # ID(s) of the SpatialBoundary message(s) for this precinct. Used to specify a geometrical boundary of the precinct.
        "A String",
      ],
      "splitName": "A String", # If present, this proto corresponds to one portion of split precinct. Other portions of this precinct are guaranteed to have the same `name`. If not present, this proto represents a full precicnt.
      "ward": "A String", # Specifies the ward the precinct is contained within.
    },
  ],
  "state": [ # Local Election Information for the state that the voter votes in. For the US, there will only be one element in this array.
    { # Describes information about a regional election administrative area.
      "electionAdministrationBody": { # Information about an election administrative body (e.g. County Board of Elections). # The election administration body for this area.
        "absenteeVotingInfoUrl": "A String", # A URL provided by this administrative body for information on absentee voting.
        "ballotInfoUrl": "A String", # A URL provided by this administrative body to give contest information to the voter.
        "correspondenceAddress": { # A simple representation of an address. # The mailing address of this administrative body.
          "city": "A String", # The city or town for the address.
          "line1": "A String", # The street name and number of this address.
          "line2": "A String", # The second line the address, if needed.
          "line3": "A String", # The third line of the address, if needed.
          "locationName": "A String", # The name of the location.
          "state": "A String", # The US two letter state abbreviation of the address.
          "zip": "A String", # The US Postal Zip Code of the address.
        },
        "electionInfoUrl": "A String", # A URL provided by this administrative body for looking up general election information.
        "electionNoticeText": "A String", # A last minute or emergency notification text provided by this administrative body.
        "electionNoticeUrl": "A String", # A URL provided by this administrative body for additional information related to the last minute or emergency notification.
        "electionOfficials": [ # The election officials for this election administrative body.
          { # Information about individual election officials.
            "emailAddress": "A String", # The email address of the election official.
            "faxNumber": "A String", # The fax number of the election official.
            "name": "A String", # The full name of the election official.
            "officePhoneNumber": "A String", # The office phone number of the election official.
            "title": "A String", # The title of the election official.
          },
        ],
        "electionRegistrationConfirmationUrl": "A String", # A URL provided by this administrative body for confirming that the voter is registered to vote.
        "electionRegistrationUrl": "A String", # A URL provided by this administrative body for looking up how to register to vote.
        "electionRulesUrl": "A String", # A URL provided by this administrative body describing election rules to the voter.
        "hoursOfOperation": "A String", # A description of the hours of operation for this administrative body.
        "name": "A String", # The name of this election administrative body.
        "physicalAddress": { # A simple representation of an address. # The physical address of this administrative body.
          "city": "A String", # The city or town for the address.
          "line1": "A String", # The street name and number of this address.
          "line2": "A String", # The second line the address, if needed.
          "line3": "A String", # The third line of the address, if needed.
          "locationName": "A String", # The name of the location.
          "state": "A String", # The US two letter state abbreviation of the address.
          "zip": "A String", # The US Postal Zip Code of the address.
        },
        "voter_services": [ # A description of the services this administrative body may provide.
          "A String",
        ],
        "votingLocationFinderUrl": "A String", # A URL provided by this administrative body for looking up where to vote.
      },
      "local_jurisdiction": # Object with schema name: AdministrationRegion # The city or county that provides election information for this voter. This object can have the same elements as state.
      "name": "A String", # The name of the jurisdiction.
      "sources": [ # A list of sources for this area. If multiple sources are listed the data has been aggregated from those sources.
        { # Contains information about the data source for the element containing it.
          "name": "A String", # The name of the data source.
          "official": True or False, # Whether this data comes from an official government source.
        },
      ],
    },
  ],
}