@@ -206,53 +206,6 @@ def _from_env_properties(cls, debug=None, enable_gzip=False, **kwargs):
206206 connection_pool_maxsize = _to_int (connection_pool_maxsize ), auth_basic = _to_bool (auth_basic ),
207207 profilers = profilers , ** kwargs )
208208
209- @classmethod
210- def _from_env (cls , debug = None , enable_gzip = False , ** kwargs ):
211- """
212- Creates and configures an instance of the class using environment variable values. The method loads
213- configuration values for connecting to an InfluxDB server instance from preset environment variables.
214- Options include connection details such as host, token, organization, and optional parameters
215- like SSL settings, profiling, and default tags. Non-specified parameters fallback to defaults
216- or None, ensuring a straightforward integration with varied InfluxDB setups.
217-
218- :param debug: Determines whether debugging mode is enabled.
219- :type debug: Optional[bool]
220- :param enable_gzip: Indicates whether gzip compression is enabled for requests.
221- :type enable_gzip: bool
222- :param kwargs: Additional keyword arguments to configure the instance.
223- :type kwargs: dict
224- :return: Instance of the class configured using the provided environmental settings.
225- :rtype: cls
226- """
227- url = os .getenv ('INFLUX_HOST' , "http://localhost:8086" )
228- token = os .getenv ('INFLUX_TOKEN' , "my-token" )
229- org = os .getenv ('INFLUX_ORG' , "my-org" )
230- timeout = os .getenv ('INFLUX_TIMEOUT' , "10000" )
231- verify_ssl = os .getenv ('INFLUX_VERIFY_SSL' , "True" )
232- ssl_ca_cert = os .getenv ('INFLUX_SSL_CA_CERT' , None )
233- cert_file = os .getenv ('INFLUX_CERT_FILE' , None )
234- cert_key_file = os .getenv ('INFLUX_CERT_KEY_FILE' , None )
235- cert_key_password = os .getenv ('INFLUX_CERT_KEY_PASSWORD' , None )
236- connection_pool_maxsize = os .getenv ('INFLUX_CONNECTION_POOL_MAXSIZE' , None )
237- auth_basic = os .getenv ('INFLUX_AUTH_BASIC' , "False" )
238-
239- prof = os .getenv ("INFLUX_PROFILERS" , None )
240- profilers = None
241- if prof is not None :
242- profilers = [x .strip () for x in prof .split (',' )]
243-
244- default_tags = dict ()
245-
246- for key , value in os .environ .items ():
247- if key .startswith ("INFLUX_TAG_" ):
248- default_tags [key [11 :].lower ()] = value
249-
250- return cls (url , token , debug = debug , timeout = _to_int (timeout ), org = org , default_tags = default_tags ,
251- enable_gzip = enable_gzip , verify_ssl = _to_bool (verify_ssl ), ssl_ca_cert = ssl_ca_cert ,
252- cert_file = cert_file , cert_key_file = cert_key_file , cert_key_password = cert_key_password ,
253- connection_pool_maxsize = _to_int (connection_pool_maxsize ), auth_basic = _to_bool (auth_basic ),
254- profilers = profilers , ** kwargs )
255-
256209
257210class _BaseWriteApi (object ):
258211 def __init__ (self , influxdb_client , point_settings = None ):
0 commit comments