You can set the TTL of a collection with our PyMilvus SDK by providing the value of the parameter collection.ttl.seconds.
The following example sets the TTL to 1800 seconds.
collection.set_properties(properties={"collection.ttl.seconds": 1800})
collection.set_properties(properties={"collection.ttl.seconds": 1800})