I tried using a token instead of user/pass, and it's been working longer, but I need to keep an eye on it. However, this does not explain why my other services are working; only this one is disconnecting and is not showing any errors.
First, I created a token with
influx auth create \
--org <ORG_NAME> \
--read-buckets \
--write-buckets \
--description "Token for My App"
and then
InfluxDBClient(url="http://localhost:8086", token="my-token", org="my-org")