mirror of
https://github.com/tiqi-group/pydase_service_base.git
synced 2025-05-07 16:00:10 +02:00
Compare commits
No commits in common. "main" and "v0.3.2" have entirely different histories.
@ -60,8 +60,6 @@ password: root
|
||||
database: my_database
|
||||
ssl: True # defaults to True
|
||||
verify_ssl: True # defaults to True
|
||||
headers:
|
||||
Host: other-virtual-host.ethz.ch
|
||||
```
|
||||
|
||||
`influxdb_config.yaml`:
|
||||
@ -69,9 +67,6 @@ headers:
|
||||
url: https://database-url.ch
|
||||
org: your-org
|
||||
token: <influxdb-token>
|
||||
verify_ssl: True # defaults to True
|
||||
headers:
|
||||
Host: other-virtual-host.ethz.ch
|
||||
```
|
||||
|
||||
`postgres_development.yaml` / `postgres_production.yaml`:
|
||||
|
@ -29,8 +29,6 @@ class InfluxDBConfig(BaseConfig): # type: ignore
|
||||
url: str
|
||||
org: str
|
||||
token: SecretStr
|
||||
verify_ssl: bool = True
|
||||
headers: dict[str, str] = {} # noqa: RUF012
|
||||
|
||||
|
||||
class InfluxDBv1Config(BaseConfig): # type: ignore
|
||||
@ -41,4 +39,3 @@ class InfluxDBv1Config(BaseConfig): # type: ignore
|
||||
database: str
|
||||
ssl: bool = True
|
||||
verify_ssl: bool = True
|
||||
headers: dict[str, str] = {} # noqa: RUF012
|
||||
|
@ -80,20 +80,12 @@ class InfluxDBSession:
|
||||
self.url = self._config.url
|
||||
self.token = self._config.token.get_secret_value()
|
||||
self.org = self._config.org
|
||||
self.headers = self._config.headers
|
||||
self.verify_ssl = self._config.verify_ssl
|
||||
self._client: InfluxDBClient
|
||||
self._write_api: WriteApi
|
||||
self._buckets_api: BucketsApi
|
||||
|
||||
def __enter__(self) -> Self:
|
||||
self._client = InfluxDBClient(
|
||||
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._client = InfluxDBClient(url=self.url, token=self.token, org=self.org)
|
||||
self._write_api = self._client.write_api(write_options=SYNCHRONOUS) # type: ignore
|
||||
return self
|
||||
|
||||
|
@ -65,7 +65,6 @@ class InfluxDBv1Session:
|
||||
self._database = self._config.database
|
||||
self._ssl = self._config.ssl
|
||||
self._verify_ssl = self._config.verify_ssl
|
||||
self._headers = self._config.headers
|
||||
|
||||
def __enter__(self) -> Self:
|
||||
self._client = influxdb.InfluxDBClient(
|
||||
@ -76,7 +75,6 @@ class InfluxDBv1Session:
|
||||
database=self._database,
|
||||
ssl=self._ssl,
|
||||
verify_ssl=self._verify_ssl,
|
||||
headers=self._headers,
|
||||
)
|
||||
return self
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user