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:
for i in range(100):
frame = next(stream)
cv2.imshow("LIVE: " + camera.roadway, 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.0.tar.gz
(7.2 kB
view details)
Built Distribution
File details
Details for the file nysdotapi-1.0.0.tar.gz
.
File metadata
- Download URL: nysdotapi-1.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8da44114c82fa5b7fc3877a0cc59e0779eb07430ab679f304542300a06e564de |
|
MD5 | 140753834f56fbe18ab83552977413f1 |
|
BLAKE2b-256 | 8215ce100142c65b0805adf189382bab78534231ddb7e48aa990be22c534fa18 |
File details
Details for the file nysdotapi-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: nysdotapi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.8 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 | c5c766f53b03ceb5746cb72d97f6fe2610c5c9815ec65d57a8945328e5e6af3b |
|
MD5 | 6fe03db897124aaada7b09408fe1543c |
|
BLAKE2b-256 | c5a7998f5c087c56a63e18a362b8f36b4cd96b1c1cb2215de253233d8ab6dde5 |