Python module for accessing the CANedge via HTTP. The CANedge HTTP interface can e.g. be used to automatically poll and then delete log files stored on the CANedge.
The module supports download, deletion, and listing of files on the CANedge.
pip install canedge_http
ce_http_downloader
: Download log files filtered by start and end-time. Runce_http_downloader --help
for information on usage.
from canedge_http import CANedgeHTTP
http = CANedgeHTTP("http://192.168.1.100")
http.device_id
Result example:
'AABBCCDD'
http.permission
Result example:
'OPTIONS, GET, HEAD, PUT, DELETE'
for elm in http.list(path="/", recursive=True):
...
Result example (elm):
{'path': '/device.json', 'is_dir': False, 'lastWritten': datetime.datetime(2024, 7, 12, 5, 3, 12, tzinfo=datetime.timezone.utc), 'size': 601}
Download takes a file-like object, e.g.
f = io.BytesIO()
http.download("/device.json", f)
or
with open("00000001.MF4", "wb") as f:
http.download("/LOG/AABBCCDD/00000001/00000001.MF4", f)
http.delete("/LOG/AABBCCDD/00000001/00000001.MF4")