Night-Stalkers / lm-scripts

PySnip Scripts
GNU General Public License v3.0
8 stars 4 forks source link

ipcheck.py API key #5

Closed Czechball closed 4 years ago

Czechball commented 4 years ago

In the current version of ipcheck.py, you provide the API key in a file under the ipcheck_data folder:

To function correctly, a file called "api_key.txt" containing a valid proxycheck.io API key must exist inside the "ipcheck_data" directory.

Isn't it better to just store it in a variable directly in ipcheck.py? Having it in a separate folder seems kinda messy to me...

hourai-dev commented 4 years ago

The reason as to why it requires the external "api_key.txt" file, is because having to ask the user to input their API key on every startup seems bothersome. Imagine you had to type your API key everytime the server started, it would get annoying after a while. This could be improved by having the user enter their API on the first startup and storing the API key somewhere in disk so it is no longer asked for after first run, however, we have reached the current situation, in which an API key file is required to function. I have decided to do that since the start, having just the user input their API key directly into the API key file. The API key file is necessary to make the API key persistent between runs, that way the script doesn't require the user to input it on every run.

Czechball commented 4 years ago

No, you don't understand what I mean. I thought the key could be entered in the script in a variable when user downloads it and then it will stay there...

Czechball commented 4 years ago

The script could have a

API_KEY = "Paste your Proxycheck.io API key here"

line. It would only need to be replaced again when updating the script.

hourai-dev commented 4 years ago

That's a good idea actually, I will make it so the user can decide whether to use an API key file, for smoother updates, or just inserting the API key directly into the script. The user can choose one of those two ways, whatever benefits them the most. I will do a commit adding the feature soon. Thanks for the idea.