pyden
is a simple library to get data from the city and county of Denver, CO.
Version 1.0.0 of pyden
makes several breaking, but necessary changes:
- Moves the underlying library from Requests to aiohttp
- 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.
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.
pip install pyden
pyden
starts within an
aiohttp ClientSession
:
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:
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())
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(<LAT>, <LON>, "<GOOGLE_API_KEY>")
# 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())
- Check for open features/bugs or initiate a discussion on one.
- Fork the repository.
- Install the dev environment:
make init
. - Enter the virtual environment:
pipenv shell
- Code your new feature or bug fix.
- Write a test that covers your new functionality.
- Run tests and ensure 100% code coverage:
make coverage
- Add yourself to
AUTHORS.md
. - Submit a pull request!