def has_done(self) -> bool
from tencent.cloud.core import errors
from tencent.cloud.core import waitable
from tencent.cloud.serverless import functions
def main():
client: functions.Client = functions.fetch_client()
create_operation: waitable.Waitable = client.create_layer(
region_id = 'ap-shanghai',
layer_name = 'default',
layer_description = 'default layer',
layer_content = functions.LayerContent().use_local_zip_archive(
local_file_path = './layer.zip'
),
layer_runtimes = [
functions.FunctionRuntime.Python
],
layer_license = 'default license'
)
try:
layer_version: int = create_operation.wait_for_done(
max_wait_seconds = 15
)
except TimeoutError:
pass
if create_operation.has_done():
print('info: layer version = {LAYER_VERSION}'.format(
LAYER_VERSION = layer_version
))
else:
print('error: the operation did not complete successfully')
if __name__ == '__main__':
main()
Tencent Cloud SDK for Python