Compare commits

..

No commits in common. "main" and "v0.3.2" have entirely different histories.
main ... v0.3.2

4 changed files with 1 additions and 19 deletions

View File

@ -60,8 +60,6 @@ password: root
database: my_database database: my_database
ssl: True # defaults to True ssl: True # defaults to True
verify_ssl: True # defaults to True verify_ssl: True # defaults to True
headers:
Host: other-virtual-host.ethz.ch
``` ```
`influxdb_config.yaml`: `influxdb_config.yaml`:
@ -69,9 +67,6 @@ headers:
url: https://database-url.ch url: https://database-url.ch
org: your-org org: your-org
token: <influxdb-token> token: <influxdb-token>
verify_ssl: True # defaults to True
headers:
Host: other-virtual-host.ethz.ch
``` ```
`postgres_development.yaml` / `postgres_production.yaml`: `postgres_development.yaml` / `postgres_production.yaml`:

View File

@ -29,8 +29,6 @@ class InfluxDBConfig(BaseConfig): # type: ignore
url: str url: str
org: str org: str
token: SecretStr token: SecretStr
verify_ssl: bool = True
headers: dict[str, str] = {} # noqa: RUF012
class InfluxDBv1Config(BaseConfig): # type: ignore class InfluxDBv1Config(BaseConfig): # type: ignore
@ -41,4 +39,3 @@ class InfluxDBv1Config(BaseConfig): # type: ignore
database: str database: str
ssl: bool = True ssl: bool = True
verify_ssl: bool = True verify_ssl: bool = True
headers: dict[str, str] = {} # noqa: RUF012

View File

@ -80,20 +80,12 @@ class InfluxDBSession:
self.url = self._config.url self.url = self._config.url
self.token = self._config.token.get_secret_value() self.token = self._config.token.get_secret_value()
self.org = self._config.org self.org = self._config.org
self.headers = self._config.headers
self.verify_ssl = self._config.verify_ssl
self._client: InfluxDBClient self._client: InfluxDBClient
self._write_api: WriteApi self._write_api: WriteApi
self._buckets_api: BucketsApi self._buckets_api: BucketsApi
def __enter__(self) -> Self: def __enter__(self) -> Self:
self._client = InfluxDBClient( self._client = InfluxDBClient(url=self.url, token=self.token, org=self.org)
url=self.url, token=self.token, org=self.org, verify_ssl=self.verify_ssl
)
for header_name, header_value in self.headers.items():
self._client.api_client.set_default_header(header_name, header_value)
self._write_api = self._client.write_api(write_options=SYNCHRONOUS) # type: ignore self._write_api = self._client.write_api(write_options=SYNCHRONOUS) # type: ignore
return self return self

View File

@ -65,7 +65,6 @@ class InfluxDBv1Session:
self._database = self._config.database self._database = self._config.database
self._ssl = self._config.ssl self._ssl = self._config.ssl
self._verify_ssl = self._config.verify_ssl self._verify_ssl = self._config.verify_ssl
self._headers = self._config.headers
def __enter__(self) -> Self: def __enter__(self) -> Self:
self._client = influxdb.InfluxDBClient( self._client = influxdb.InfluxDBClient(
@ -76,7 +75,6 @@ class InfluxDBv1Session:
database=self._database, database=self._database,
ssl=self._ssl, ssl=self._ssl,
verify_ssl=self._verify_ssl, verify_ssl=self._verify_ssl,
headers=self._headers,
) )
return self return self