In this post I am going to explain a code block which I used for retrying iteration of a loop if it gets failed.
This is the code
def get_port_list_traffic(port_list, connnection_handler):
port_traffic_data_list = []
# variables for adding total traffic
total_in_traffic = 0
total_out_traffic = 0
for port in port_list:
retries = 0
max_retries = 5 …