Closed raffaem closed 2 years ago
That's correct, module startup.py
reads the configuration file and stores the keys in KEYS
. It's not intended to set the keys on runtime.
Why don't you just change the keys in the configuration file?
Why don't you just change the keys in the configuration file?
Because it's a shared computer and the documentation says I can change them from code
You probably refer to https://pybliometrics.readthedocs.io/en/stable/configuration.html#runtime, right?
It used to be possible to assign keys at runtime, but since I implemented throttling it was too difficult to maintain this feature (especially while maintaining a smooth compilation on rtfd.io).
But what should work is to change the location of the configuration at runtime (but before importing pybliometrics) as in https://pybliometrics.readthedocs.io/en/stable/configuration.html#custom-location This should give you the possibility to have distinct keys on the same installation. The only downside is that you would have to write the same directories in different configuration files.
You probably refer to https://pybliometrics.readthedocs.io/en/stable/configuration.html#runtime, right?
Yes
It used to be possible to assign keys at runtime, but since I implemented throttling it was too difficult to maintain this feature (especially while maintaining a smooth compilation on rtfd.io).
Let's change the docs if that is no longer the case :)
But what should work is to change the location of the configuration at runtime (but before importing pybliometrics) as in https://pybliometrics.readthedocs.io/en/stable/configuration.html#custom-location This should give you the possibility to have distinct keys on the same installation.
ok, I'll try that. For the moment I achieved what I had to do.
The only downside is that you would have to write the same directories in different configuration files.
Why, if I want to keep the cache separate?
For now I the documentation make clear that one cannot set keys at runtime. Maybe in future this will be possible.
Seems like duplicate (or related to) #161
I'm setting my API key from code, by writing
both before
and after it.
But pybliometrics is still using the API key from
config.ini
.I know because I get a "Scopus401Error: Invalid API Key" error, and I have modified
pybliometrics/scopus/utils/get_content.py
by addingafter
in the
get_content
function, and it is printing the API key in the config file.