How to add more than one shape with loop in plotly

I use plotly package to show dynamix finance chart at python. However I didnโ€™t manage to put my all key points lines on one chart with for loop. Here is my code:

    fig.update_layout(
        for i in range(0,len(data)):
            shapes=[
                go.layout.Shape(
                type="rect",
                x0=data['Date'][i],
                y0=data['Max_alt'][i],
                x1='2019-12-31',
                y1=data['Max_ust'][i],
                fillcolor="LightSkyBlue",
                opacity=0.5,
                layer="below",
                line_width=0)])
    fig.show()

@seandepar the simplest way to define your shapes is to define
them by list comprehension:

shapes = go.layout.Shape(
                type="rect",
                x0=data['Date'][i],
                y0=data['Max_alt'][i],
                x1='2019-12-31',
                y1=data['Max_ust'][i],
                fillcolor="LightSkyBlue",
                opacity=0.5,
                layer="below",
                line_width=0)] for i in range(len(data))]

See this example https://plot.ly/~empet/15269 that defines shapes of type=โ€˜rectโ€™ with x0, x1 given as dates.

Your code has the drawback that it updates layout as follows:
fig.update_layout(shapes = [type='rect' for i =0], shapes =[type='rect' for i =1], ...),
but layout cannot admit more than one list, shapes, as attribute.