Skip to main content

A python wrapper for Google's Civic Information API

Project description

google-civic-information-api-py

PyPI GitHub PyPI - Python Version GitHub Workflow Status

google-civic-information-api-py is a Python wrapper for Google's Civic Information API.

Installation

Installing with Pip from Pypi

pip install google-civic-information-api

Installing with Pip Locally

git clone https://github.com/k0pak4/google-civic-information-api-py.git
cd google-civic-information-api-py
pip install .

Usage

The google-civic-information-api has three modules: divisions, elections, and representatives. Each module has a few functions, examples of each are provided below.

divisions

import os
from google_civic_information_api import divisions

civic_api_key = os.environ["TEST_CIVIC_INFO_API_KEY"]

# Search Divisions by Address
search_results = divisions.search(civic_api_key, "District of Columbia")
print(search_results.json())

elections

import os
from google_civic_information_api import elections

civic_api_key = os.environ["TEST_CIVIC_INFO_API_KEY"]

# Search all Elections
elections_results = elections.elections(civic_api_key)
print(elections_results.json())

representatives

import os
from google_civic_information_api import 

civic_api_key = os.environ["TEST_CIVIC_INFO_API_KEY"]

# Retrieve all country level representatives from D.C. by searching by Address
dc_results = representatives.representative_info_by_address(
        civic_api_key, "20001", recursive=True, levels="country")
print(dc_results.json())

# Retrieve all country level representatives from D.C. by searching by OCD Division
dc_results = representatives.representative_info_by_division(
        civic_api_key, "ocd-division/country:us/district:dc", recursive=True, levels="country")
print(dc_results.json())

Contributing

Refer to the Contributing Guide for details on opening issues, pull requests, and development considerations.

Security

Refer to the Security Policy for details on supported versions, reporting vulnerabilities, and security considerations.

License

BSD 3-Clause License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

google-civic-information-api-1.0.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

google_civic_information_api-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file google-civic-information-api-1.0.0.tar.gz.

File metadata

File hashes

Hashes for google-civic-information-api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7c7427c8b79bbf8af9080752d90e5ccb9439da9ffad18f6915adf99f2cacf9c2
MD5 a779a71c5fd483359731d2255dc6c06b
BLAKE2b-256 83abea1277bf6195d04a318ee8fc76864c1a3095f8938debb39ca0f071a6138b

See more details on using hashes here.

File details

Details for the file google_civic_information_api-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_civic_information_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8944390c17970e1a8bb8e3e2dd0eac6e09be0a1e9e14dd483931bc22872762fa
MD5 091a04a79d5004544aea3d782381764e
BLAKE2b-256 930ff961b0cbbd1bd7c8f408ae327560ca305a803fd5d18b7ca810d47ed1b316

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page