Here is my code:
library(httr)
repeat {
request<-list(status_code=0)
while(request$status_code!=200){
try({
request <- RETRY("GET",
"https://api.coinex.com/v1/market/deals?market=BTCUSDT&limit=1",
times = 10,
pause_base = 0.1, pause_cap = 60, pause_min = 0.1)
})
}
response <- content(request, as = "text", encoding = "UTF-8")
#some functions
print('some results')
}
It works fine most of the time but at some seconds it produced tens of the following error:
Error in UseMethod("http_error") :
no applicable method for 'http_error' applied to an object of class "c('simpleError', 'error', 'condition')"
what does this error even mean? how can I avoid it or see it less frequently? sometimes it covers all my console and I can't find the results among them. of course, I can save the results in an object but the main issue is about the error, besides I prefer them in the console to know about them at time.
I used to think this error relates to when API fails but I saw the following warning a very few times which relates to that:
Request failed [502]. Retrying in 0.1 seconds...