Closed MislavSag closed 3 years ago
As far as I know, all SimFin API keys have a length of 32 characters and may contain characters and numbers. This is checked before setting the API key.
In your example, the API key contains ...
which is not allowed. This is why you get the error.
I suspect, your real API key looks different. Please report if it's length is not 32 or if it contains other elements than characters or numbers (and which).
My API key is OK (it contains characters and numbers). I have added ... to hide my API key.
I see there is a code:
if (env_var_specified) {
options(sfa_api_key = Sys.getenv(env_var))
}
So I have to provide environment variable name that contains my api key?
Sorry, I can't reproduce your problem in the recent dev version. Do you really get the exact same error as shown above? Because this error only occurs if your API key's length differs from 32 or if it contains other elements than characters and/or numbers. You can test this using grepl('^[[:alnum:]]{32}$', "InsertYourApiKey")
.
You do not have to provide an environment variable name (even though I would recommend this, because then you don't have to insert your API key in your script file). For details see ?sfa_set_api_key
, especially the examples:
# set API key directly
sfa_set_api_key(api_key = "YourApiKey")
# set API key via environment variable
# (this assumes you already created an environment variable called
# 'SIMFIN_API_KEY' which contains your API key)
sfa_set_api_key(env_var = "SIMFIN_API_KEY")
@MislavSag, could you solve your problem?
No, I just use API inside function every time. But I am sure the problem is not in API string. I can send you my API key by e-mail.
No, you should never pass your API key to someone else. But it would be helpful if you would provide a real reprex
, including your session info.
Have you checked your API key as decribed above?
grepl('^[[:alnum:]]{32}$', "InsertYourApiKey")
This should return TRUE
. If not, please provide an example of your API key where you replace all digits.
That returns TRUE, I tried that right after I saw there is an error.
This should return
TRUE
. If not, please provide an example of your API key where you replace all digits.
Closing the issue since I don't have the information to reproduce the error.
When I want to set api key as environment variable:
I get an error: