I think waiting between retries is a good thing to try when something over the network fails, but I'm just confused why the assignment is being done here. As the retry loop iterates, you'll be assigning to the variable multiple times for no reason since the value doesn't change in between. Which is why I think it'll be better to move the assignment outside the loop (or make it a class attribute if you prefer). It's not a big deal in this case, just a bit messy logic, but doing this for assignments that aren't efficient can be a problem so it's good practice to get used to avoiding it.