Metadata-Version: 2.1
Name: google-civic-information-api
Version: 1.0.0
Summary: A python wrapper for Google's Civic Information API
Author: Matthew Mathur
License: BSD 3-Clause License
        
        Copyright (c) 2023, Matthew Mathur
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/k0pak4/google-civic-information-api-py
Keywords: civic-information-api
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# google-civic-information-api-py
![PyPI](https://img.shields.io/pypi/v/google-civic-information-api?color=blue&label=PyPi&style=plastic)
![GitHub](https://img.shields.io/github/license/k0pak4/google-civic-information-api-py?label=License&style=plastic)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/google-civic-information-api?label=Python&style=plastic)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/k0pak4/google-civic-information-api-py/run-unit-tests.yml?style=plastic)

google-civic-information-api-py is a Python wrapper for [Google's Civic Information API](https://developers.google.com/civic-information/docs/v2).

## Installation

### Installing with Pip from Pypi

```bash
pip install google-civic-information-api
```

### Installing with Pip Locally
```bash
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
```python
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
```python
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
```python
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](https://github.com/k0pak4/google-civic-information-api-py/blob/main/CONTRIBUTING.md) for details on opening issues, pull requests, and development considerations.

## Security
Refer to the [Security Policy](https://github.com/k0pak4/google-civic-information-api-py/blob/main/SECURITY.md) for details on supported versions, reporting vulnerabilities, and security considerations.

## License

[BSD 3-Clause License](https://github.com/k0pak4/google-civic-information-api-py/blob/main/LICENSE)
