Nysdotapi 1.0.1 | Coderz Repository

nysdotapi 1.0.1

Last updated:

0 purchases

nysdotapi 1.0.1 Image
nysdotapi 1.0.1 Images

Free

Languages

Categories

Add to Cart

Description:

nysdotapi 1.0.1

New York State Department of Transportation API




Installation
pip install nysdotapi

Authentication

Visit the 511 NY website and create a new account
Login to your account and request an API key here

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

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.