https://github.com/bachya/pyden
📡 A Python API for getting information from the City and County of Denver, CO
https://github.com/bachya/pyden
asyncio city denver python3
Last synced: about 1 year ago
JSON representation
📡 A Python API for getting information from the City and County of Denver, CO
- Host: GitHub
- URL: https://github.com/bachya/pyden
- Owner: bachya
- License: mit
- Created: 2017-07-21T21:30:54.000Z (almost 9 years ago)
- Default Branch: dev
- Last Pushed: 2021-12-02T21:03:41.000Z (over 4 years ago)
- Last Synced: 2025-03-06T21:46:57.218Z (over 1 year ago)
- Topics: asyncio, city, denver, python3
- Language: Python
- Homepage:
- Size: 78.1 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 📡 pyden: A simple Python API for Denver, CO Data
[](https://travis-ci.org/bachya/pyden)
[](https://pypi.python.org/pypi/pyden)
[](https://pypi.python.org/pypi/pyden)
[](https://github.com/bachya/pyden/blob/master/LICENSE)
[](https://codecov.io/gh/bachya/pyden)
[](https://codeclimate.com/github/bachya/pyden/maintainability)
[](https://saythanks.io/to/bachya)
`pyden` is a simple library to get data from the city and county of Denver, CO.
# PLEASE READ: Version 1.0.0 and Beyond
Version 1.0.0 of `pyden` makes several breaking, but necessary changes:
* Moves the underlying library from
[Requests](http://docs.python-requests.org/en/master/) to
[aiohttp](https://aiohttp.readthedocs.io/en/stable/)
* Changes the entire library to use `asyncio`
* Makes 3.6 the minimum version of Python required
If you wish to continue using the previous, synchronous version of
`pyden`, make sure to pin version 0.4.1.
# Python Versions
`pyden` is currently supported on:
* Python 3.5
* Python 3.6
* Python 3.7
However, running the test suite currently requires Python 3.6 or higher; tests
run on Python 3.5 will fail.
# Installation
```python
pip install pyden
```
# Usage
`pyden` starts within an
[aiohttp](https://aiohttp.readthedocs.io/en/stable/) `ClientSession`:
```python
import asyncio
from aiohttp import ClientSession
from pyden import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
# YOUR CODE HERE
asyncio.get_event_loop().run_until_complete(main())
```
To create a client, simply:
```python
import asyncio
from aiohttp import ClientSession
from pyden import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
client = Client(websession)
asyncio.get_event_loop().run_until_complete(main())
```
## Trash Schedule
```python
import asyncio
from aiohttp import ClientSession
from pyden import Client
async def main() -> None:
"""Create the aiohttp session and run the example."""
async with ClientSession() as websession:
client = Client(websession)
# Initialize the trash module:
await client.trash.init_from_coords(, , "")
# Get the full schedule:
await client.trash.schedule()
# ...or get the date of next pickup:
await client.trash.next_pickup(client.trash.PickupTypes.recycling)
asyncio.get_event_loop().run_until_complete(main())
```
# Contributing
1. [Check for open features/bugs](https://github.com/bachya/pyden/issues)
or [initiate a discussion on one](https://github.com/bachya/pyden/issues/new).
2. [Fork the repository](https://github.com/bachya/pyden/fork).
3. Install the dev environment: `make init`.
4. Enter the virtual environment: `pipenv shell`
5. Code your new feature or bug fix.
6. Write a test that covers your new functionality.
7. Run tests and ensure 100% code coverage: `make coverage`
8. Add yourself to `AUTHORS.md`.
9. Submit a pull request!