Skip to contents

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.

Usage

get_api(api_name)

Arguments

api_name

A character string representing the name of the API key to be retrieved from secrets.yaml file.

Value

A character vector containing the value of the requested API key.

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