This function retrieves an API key by reading a secrets.yaml file stored in the current working directory. The specified 'api_name' is used to retrieve the corresponding API key.
Arguments
- api_name
A character string representing the name of the API key to be retrieved from secrets.yaml file.
Examples
#Read API token for Twitter API from secrets.yaml
get_api("Twitter_API")
#> Warning: cannot open file 'D:/Github/CovidCAR/docs/reference/secrets.yaml': No such file or directory
#> Error in file(file, "rt", encoding = fileEncoding): cannot open the connection
#Read API token for OpenWeather API from secrets.yaml
get_api("OpenWeather_API")
#> Warning: cannot open file 'D:/Github/CovidCAR/docs/reference/secrets.yaml': No such file or directory
#> Error in file(file, "rt", encoding = fileEncoding): cannot open the connection