# New York State Department of Transportation API
[![PyPI download month](https://img.shields.io/pypi/dm/nysdotapi.svg)](https://pypi.python.org/pypi/nysdotapi/)
[![PyPI - Status](https://img.shields.io/pypi/status/nysdotapi)](https://pypi.python.org/pypi/nysdotapi/)
[![PyPI](https://img.shields.io/pypi/v/nysdotapi)](https://pypi.python.org/pypi/nysdotapi/)
![GitHub](https://img.shields.io/github/license/ryanrudes/traffic)
## Installation
```bash
pip install nysdotapi
```
## Authentication
1. Visit the 511 NY [website](https://511ny.org/my511/register) and create a new account
2. Login to your account and request an API key [here](https://511ny.org/developers/help)
## Example
The following code cycles through live feeds of various traffic cameras at random.
```python
from traffic import API
import random
import cv2
api = API("<insert-api-key>")
cameras = api.get_cameras()
print("Cameras:", len(cameras))
while True:
camera = random.choice(cameras)
try:
with camera.get_stream() as stream:
title = "LIVE: " + camera.roadway if camera.roadway else "LIVE"
for i in range(100):
frame = next(stream)
cv2.imshow(title, frame)
cv2.waitKey(1)
cv2.destroyAllWindows()
except KeyboardInterrupt:
raise
except StopIteration:
pass
```
Raw data
{
"_id": null,
"home_page": "https://github.com/ryanrudes/traffic",
"name": "nysdotapi",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ny,traffic,live,stream,feed,camera,road,street",
"author": "Ryan Rudes",
"author_email": "ryanrudes@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b3/df/aa68edec274a6209ab65641cfa5815fce1503c2c22dcdd92d41b065ce6e0/nysdotapi-1.0.1.tar.gz",
"platform": null,
"description": "# New York State Department of Transportation API\n\n[![PyPI download month](https://img.shields.io/pypi/dm/nysdotapi.svg)](https://pypi.python.org/pypi/nysdotapi/)\n[![PyPI - Status](https://img.shields.io/pypi/status/nysdotapi)](https://pypi.python.org/pypi/nysdotapi/)\n[![PyPI](https://img.shields.io/pypi/v/nysdotapi)](https://pypi.python.org/pypi/nysdotapi/)\n![GitHub](https://img.shields.io/github/license/ryanrudes/traffic)\n\n## Installation\n```bash\npip install nysdotapi\n```\n\n## Authentication\n1. Visit the 511 NY [website](https://511ny.org/my511/register) and create a new account\n2. Login to your account and request an API key [here](https://511ny.org/developers/help)\n\n## Example\nThe following code cycles through live feeds of various traffic cameras at random.\n\n```python\nfrom traffic import API\n\nimport random\nimport cv2\n\napi = API(\"<insert-api-key>\")\n\ncameras = api.get_cameras()\nprint(\"Cameras:\", len(cameras))\n\nwhile True:\n camera = random.choice(cameras)\n \n try:\n with camera.get_stream() as stream:\n title = \"LIVE: \" + camera.roadway if camera.roadway else \"LIVE\"\n \n for i in range(100):\n frame = next(stream)\n \n cv2.imshow(title, frame)\n cv2.waitKey(1)\n \n cv2.destroyAllWindows()\n except KeyboardInterrupt:\n raise\n except StopIteration:\n pass\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "NYS DOT Traffic Camera Python API",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/ryanrudes/traffic"
},
"split_keywords": [
"ny",
"traffic",
"live",
"stream",
"feed",
"camera",
"road",
"street"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "59b8c28928fc718482973346e011ea8ba7aa1d2694695dd5a0d0461264c231b3",
"md5": "c714f48719419533e83cdb86959352f8",
"sha256": "5fd242a4d269d60490b6754644b427ec5858e439b1382121a6d35674d2c02d67"
},
"downloads": -1,
"filename": "nysdotapi-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c714f48719419533e83cdb86959352f8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8647,
"upload_time": "2023-08-18T01:56:46",
"upload_time_iso_8601": "2023-08-18T01:56:46.844533Z",
"url": "https://files.pythonhosted.org/packages/59/b8/c28928fc718482973346e011ea8ba7aa1d2694695dd5a0d0461264c231b3/nysdotapi-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b3dfaa68edec274a6209ab65641cfa5815fce1503c2c22dcdd92d41b065ce6e0",
"md5": "c123aa5a13e1eea0d810784fa8734141",
"sha256": "bd5ab572700cbb97436d8f12270ab4d5bd8313f077ef05521f12baaca0fccb30"
},
"downloads": -1,
"filename": "nysdotapi-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "c123aa5a13e1eea0d810784fa8734141",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7014,
"upload_time": "2023-08-18T01:56:48",
"upload_time_iso_8601": "2023-08-18T01:56:48.410227Z",
"url": "https://files.pythonhosted.org/packages/b3/df/aa68edec274a6209ab65641cfa5815fce1503c2c22dcdd92d41b065ce6e0/nysdotapi-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-18 01:56:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ryanrudes",
"github_project": "traffic",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nysdotapi"
}