minor edit ot get statsion data
This commit is contained in:
parent
12cebe247a
commit
e227f2b172
1 changed files with 4 additions and 2 deletions
|
|
@ -23,13 +23,15 @@ getStationData <- function(start_date, end_date, station_id,headers = headers,dp
|
||||||
response <- GET(url_with_params, headers)
|
response <- GET(url_with_params, headers)
|
||||||
while(response$status_code == 204){
|
while(response$status_code == 204){
|
||||||
response <- GET(url_with_params, headers)
|
response <- GET(url_with_params, headers)
|
||||||
print("file not finisehed")
|
print("file not finished yet, wait 5s")
|
||||||
Sys.sleep(5)
|
Sys.sleep(5)
|
||||||
}
|
}
|
||||||
if(response$status_code == 201){
|
if(response$status_code == 201){
|
||||||
return(read.csv(text=content(response,as="text")[[1]],sep=";",header=T,dec = ","))
|
return(read.csv(text=content(response,as="text")[[1]],sep=";",header=T,dec = ","))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stop(sprintf("Failed to retrieve data from the API. Status code: %s", response$status_code))
|
print(sprintf("Failed to retrieve data from the API. Status code: %s", response$status_code))
|
||||||
|
return(NULL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue