Closed ueg1990 closed 8 years ago
This doesn't work for me. The exception never runs.
Also why is the config dict named footballdata
?
Could we just do:
from config import config
# ...
api_token = config.get('SOCCER_CLI_API_TOKEN')
config.py
config = {
"SOCCER_CLI_API_TOKEN": "38904ru093urw349rfphjwfiohewspf",
}
I can do that. You should remove ur comment as it has ur API key :P
So do you have an env variable? if not, then maybe make sure the key is correct or re-run the setup.py script. I do 'python setup.py develop'
I do not have an env variable set but I have the key set in config.py.
I just made up that API_KEY :smile:
hey, i think i found the reason why it didnt catch the exception...fixed it in latest commit
Works for me now.
Maybe ConfigParser instead of a separate .py file?
Not sure if it's any better or worse.
@ueg1990 Shouldn't there be an exception handler to import config.py
. When a user installs the app for the forst time, it gives the error ImportError: No module named config
. I'll add that in README anyway.
Thats true. In the REAME.md, mention both options of env variable and defining a config file (the config file steps are similar to authtoken.py). You can show them an example of the config.py: config = { "SOCCER_CLI_API_TOKEN": "38904ru093urw349rfphjwfiohewspf", }
In this change, i have included both ways to loading an API token.
Here is how the config.py file is expected to look like:
footballdata = { "SOCCER_CLI_API_TOKEN" : "xxxxxxx" }