TLDR: How can I ask my code to refresh if it gets error 502 and do it until the query is successful?
I am scraping hourly data from 27/01/2016 to 15/