NYS DOT Traffic Camera Python API
Project description
New York State Department of Transportation API
Installation
pip install nysdotapi
Authentication
Example
The following code cycles through live feeds of various traffic cameras at random.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nysdotapi-1.0.1.tar.gz
(7.0 kB
view details)
Built Distribution
File details
Details for the file nysdotapi-1.0.1.tar.gz
.
File metadata
- Download URL: nysdotapi-1.0.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd5ab572700cbb97436d8f12270ab4d5bd8313f077ef05521f12baaca0fccb30 |
|
MD5 | c123aa5a13e1eea0d810784fa8734141 |
|
BLAKE2b-256 | b3dfaa68edec274a6209ab65641cfa5815fce1503c2c22dcdd92d41b065ce6e0 |
File details
Details for the file nysdotapi-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: nysdotapi-1.0.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fd242a4d269d60490b6754644b427ec5858e439b1382121a6d35674d2c02d67 |
|
MD5 | c714f48719419533e83cdb86959352f8 |
|
BLAKE2b-256 | 59b8c28928fc718482973346e011ea8ba7aa1d2694695dd5a0d0461264c231b3 |