Skip to main content

NYS DOT Traffic Camera Python API

Project description

New York State Department of Transportation API

PyPI download month PyPI - Status PyPI GitHub

Installation

pip install nysdotapi

Authentication

  1. Visit the 511 NY website and create a new account
  2. 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:
            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

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)

Uploaded Source

Built Distribution

nysdotapi-1.0.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

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

Hashes for nysdotapi-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8da44114c82fa5b7fc3877a0cc59e0779eb07430ab679f304542300a06e564de
MD5 140753834f56fbe18ab83552977413f1
BLAKE2b-256 8215ce100142c65b0805adf189382bab78534231ddb7e48aa990be22c534fa18

See more details on using hashes here.

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

Hashes for nysdotapi-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c766f53b03ceb5746cb72d97f6fe2610c5c9815ec65d57a8945328e5e6af3b
MD5 6fe03db897124aaada7b09408fe1543c
BLAKE2b-256 c5a7998f5c087c56a63e18a362b8f36b4cd96b1c1cb2215de253233d8ab6dde5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page