When using a wrongly formatted token, e.g.
s.add("123423123123123123 123123", "123423123123123123123123")
(note the space) an error is produced.
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.flukso.net/sensor/123423123123123123%20123123/tmpo/sync?rid=0&lvl=0&bid=0
This error persists when fixing the typo since the tokens are apparently cached without checking whether the format is correct. The problem is fixed with s.remove("123423123123123123 123123"). Still, a format check would be useful. E.g.
import re
correctlyFormatted = re.match(r"^[a-z0-9]{32}$", token) is not None
should work.
When using a wrongly formatted token, e.g.
(note the space) an error is produced.
This error persists when fixing the typo since the tokens are apparently cached without checking whether the format is correct. The problem is fixed with
s.remove("123423123123123123 123123"). Still, a format check would be useful. E.g.should work.