pybliometrics-dev / pybliometrics

Python-based API-Wrapper to access Scopus
https://pybliometrics.readthedocs.io/en/stable/
Other
414 stars 129 forks source link

Implement init() function to replace execution of code on import #311

Closed Michael-E-Rose closed 8 months ago

Michael-E-Rose commented 10 months ago

Currently pybliometrics reads the configuration file on import and provides keys and other things (here). If the configuration file doesn't exist, it prompts the user to create it. This is not a clean solution.

Instead, create an .init() file with one optional parameter. The optional parameter is the location of the configuration file. If none given, use the current default. Users have to call this function after the import, before using any class. It will read out the configuration file, and if doesn't exist, prompt the users for it.

Michael-E-Rose commented 10 months ago

Let's also experiment with relative paths in the config reader: users provide a relative path which will be interpreted relative to where the script is being executed.

Michael-E-Rose commented 10 months ago

Let's also add a second parameter for keys. If keys are passed in the init() function, they will be used and not the ones from the configuration file.