etcd3ref/client.py
def put_if_not_exists(self, key, value, lease=None):
        """
        Atomically puts a value only if the key previously had no value.

        This is the etcdv3 equivalent to setting a key with the etcdv2
        parameter prevExist=false.

        :param key: key in etcd to put
        :param value: value to be written to key
        :type value: bytes
        :param lease: Lease to associate with this key.
        :type lease: either :class:`.Lease`, or int (ID of lease)
        :returns: state of transaction, ``True`` if the put was successful,
                  ``False`` otherwise
        :rtype: bool
        """
        try:
            return self.__put_if_not_exists(key, lease, value)
        except _InactiveRpcError as e:
            print("Exception {} happened, try to reconnect \n".format(e))
            self.reconnect()
            return self.__put_if_not_exists(key, lease, value)

        Atomically puts a value only if the key previously had no value.

        This is the etcdv3 equivalent to setting a key with the etcdv2
        parameter prevExist=false.

        :param key: key in etcd to put
        :param value: value to be written to key
        :type value: bytes
        :param lease: Lease to associate with this key.
        :type lease: either :class:`.Lease`, or int (ID of lease)
        :returns: state of transaction, ``True`` if the put was successful,
                  ``False`` otherwise
        :rtype: bool
        
Atomically puts a value only if the key previously had no value.
This is the etcdv3 equivalent to setting a key with the etcdv2
parameter prevExist=false.
Atomically puts a value only if the key previously had no value . This is the etcdv3 equivalent to setting a key with the etcdv2 parameter prevExist = false .
def put_if_not_exists(self, key, value, lease=None):
        try:
            return self.__put_if_not_exists(key, lease, value)
        except _InactiveRpcError as e:
            print("Exception {} happened, try to reconnect \n".format(e))
            self.reconnect()
            return self.__put_if_not_exists(key, lease, value)
def put_if_not_exists ( self , key , value , lease = None ) : try : return self . __put_if_not_exists ( key , lease , value ) except _InactiveRpcError as e : print ( "Exception {} happened, try to reconnect \n" . format ( e ) ) self . reconnect ( ) return self . __put_if_not_exists ( key , lease , value )
Atomically puts a value only if the key previously had no value.
Atomically puts a value only if the key previously had no value .
"""
        Atomically puts a value only if the key previously had no value.

        This is the etcdv3 equivalent to setting a key with the etcdv2
        parameter prevExist=false.

        :param key: key in etcd to put
        :param value: value to be written to key
        :type value: bytes
        :param lease: Lease to associate with this key.
        :type lease: either :class:`.Lease`, or int (ID of lease)
        :returns: state of transaction, ``True`` if the put was successful,
                  ``False`` otherwise
        :rtype: bool
        """
state of transaction, ``True`` if the put was successful,
``False`` otherwise
state of transaction ` ` True ` ` if the put was successful ` ` False ` ` otherwise
bool
self
key
key in etcd to put
key in etcd to put
value
value to be written to key
value to be written to key
lease
Lease to associate with this key.
Lease to associate with this key .