OHGO Wrapper
This is a python package that provides a simple interface to the OHGO API.
Installation
pip install ohgo
Examples
Authentication
from ohgo import OHGOClient
# Register with OHGo for an API Key (https://publicapi.ohgo.com/docs/registration)
client = OHGOClient(api_key='YOUR-API-KEY')
Get Cameras (default page size is 500)
cameras = client.get_cameras()
Get All Cameras
from ohgo.models import QueryParams
params = QueryParams(page_all=True)
cameras = client.get_cameras(params=params)
Get Cameras by Filter
from ohgo.models import QueryParams
from ohgo.types import Region
params = QueryParams(county=Region.COLUMBUS, page_size=10, page=2)
cameras = client.get_cameras(params=params)
Get Camera by ID
camera = client.get_camera(camera_id='YOUR-CAMERA-ID')
Get Images from Camera
camera = client.get_camera(camera_id='YOUR-CAMERA-ID')
images = client.get_images(camera, "small") # Returns [ Image, Image, ... ]
# OR
camera_view = camera.camera_views[0]
images = client.get_image(camera_view, "small") # Returns Image
Other Endpoints
client.get_digital_signs() # -> List[DigitalSign]
client.get_constructions() # -> List[Construction]
client.get_weather_sensor_sites() # -> List[WeatherSensorSite]
client.get_incidents() # -> List[Incident]
client.get_dangerous_slowdowns() # -> List[DangerousSlowdown]
client.get_travel_delays() # -> List[TravelDelay]
client.get_cameras() # -> List[Camera]
Other Query Objects
from ohgo.models import QueryParams, DigitalSignParams, ConstructionParams, WeatherSensorSiteParams
from ohgo.types import Region, SignType
import datetime
# Note: If you use *all* these params you will probably get no results
params = QueryParams(page_size=10, page=2, region=Region.COLUMBUS, map_bounds_sw=(39.9612, -82.9988), map_bounds_ne=(40.0150, -82.8874), radius=(39.9612, -82.9988, 10))
digital_sign_params = DigitalSignParams(sign_type=SignType.DMS)
# You can use string in the format 'YYYY-MM-DD', but it is recommended to use datetime objects
construction_params = ConstructionParams(include_future=datetime.datetime.now(), future_only=datetime.datetime.now())
weather_sensor_site_params = WeatherSensorSiteParams(hazards_only=True)
# All params inherit default attributes from QueryParams
Cacheing Responses (ETag)
For convenience, the OHGo API supports ETag headers. If you pass an etag value in the request, the API will return an empty list if there are no changes since the last request. This can be useful for reducing the number of requests made to the API. This applies to all endpoints.
cameras = client.get_cameras() # -> Technically returns CameraListResult object
etag = cameras.etag # -> Store this etag value and pass it in the next request
new_cameras = client.get_cameras(etag=etag) # -> Returns empty list if no changes since last request
cached = new_cameras.cached # -> True if the response was cached
if (cached):
# use your original set of data
return cameras
else:
# use the new set of data
return new_cameras
Metadata
Release files for ohgo 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ohgo-1.0.4.tar.gz | 17.0 kB | Without provenance | Details for ohgo-1.0.4.tar.gz |
Release files / ohgo-1.0.4.tar.gz
| Download URL | ohgo-1.0.4.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4aa7f13f77a58911fc0898c7e2b958a72bc74a195450ccc979f590e55cc687a
|
|
BLAKE2b-256 checksum How to use checksums |
d5788a764a1af80ed7565e0b662fa8b500b4ce2e5a30fce18525deb515936005
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Security for ohgo 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.