API crashes when requesting float values for startDate and endDate
Closed this issue · 0 comments
Problem
Calling the failing URL:
http://api1.aleph.im:4024/api/v0/messages.json?pagination=200&page=1&msgType=PROGRAM&startDate=1660828440.0&endDate=1660828500.0
Returns the error message: invalid literal for int() with base 10: '1660828440.0'
This URL works (no message but no error message):
http://api1.aleph.im:4024/api/v0/messages.json?pagination=200&page=1&msgType=PROGRAM&startDate=1660828440&endDate=1660828500
Diagnostic
Calling int()
on a float is not supported by Python. Ex: int(0.5)
.
Relevant code:
pyaleph/src/aleph/web/controllers/utils.py
Lines 71 to 72 in 26c1e30
Proposal
Replace int()
with float()
.
Floating datetimes may be required for some usecases, so this should be fixed server side and not client side.