Skip to content

GitHub Actions alerts about slow traffic

License

Notifications You must be signed in to change notification settings

tblanarik/daily-traffic

Repository files navigation

daily-traffic

CodeQL

daily-traffic is a Python program that retrieves traffic flow data from the Washington State Department of Transportation (WSDOT) API and sends a message to the specified POST endpoint and recipients if traffic is slow (FlowReadingValue > 1).

Usage

To run daily-traffic, use the following command:

usage: main.py [-h] --access-code ACCESS_CODE --flow-data-id FLOW_DATA_ID --recipients RECIPIENTS --post-url POST_URL

where <access_code> is your WSDOT API access code and <flow_data_id> is the ID of the traffic flow data to retrieve.

You can obtain an access code here: https://wsdot.wa.gov/traffic/api/

See the usage for the TrafficFlow API here.

To find the list of available flow_data_id numbers:

curl --location --request GET 'http://wsdot.wa.gov/Traffic/api/TrafficFlow/TrafficFlowREST.svc/GetTrafficFlowsAsJson?AccessCode={ACCESS CODE}'

which returns a list of objects:

    {
        "FlowDataID": 2532,
        "FlowReadingValue": 1,
        "FlowStationLocation": {
            "Description": "14th",
            "Direction": "NB",
            "Latitude": 47.032581343,
            "Longitude": -122.891744891,
            "MilePost": 105.38,
            "RoadName": "005"
        },
        "Region": "Olympic",
        "StationName": "005es10538",
        "Time": "/Date(1681453282000-0700)/"
    }

License

daily-traffic is licensed under the MIT License. See LICENSE for more information.

Note

95% of this application was written with Copilot X

About

GitHub Actions alerts about slow traffic

Resources

License

Stars

Watchers

Forks

Languages