For many specific error situations both post_measurements and get_sensor_data throw a too generic exception:
An error occurred communicating with the API...
This is not helpful for debugging. For example when a wrong unit (of measurement) is sent, it could indicate this, or when an invalid date (string) for start or duration is sent this could be mentioned in the exception (pref. with the "erroneous" data).
Also, when the sensor_id is invalid (0) this general message shows..