MrCheatEugene / keepup

Auto-restart for Aeza's AMS-PROMO servers. Supports authorization by API key, and by login/password
The Unlicense
9 stars 0 forks source link

Update keepup.py #5

Closed ArifJanMC closed 1 year ago

ArifJanMC commented 1 year ago

Refactoring the ping function: This function performs a GET request to the server and logs the status. It also catches two exceptions but it repeats the logging and return statement for both of them. This can be improved by catching both exceptions at once.

Refactoring the reboot function: This function is quite large and does many things. It can be broken down into smaller functions to improve readability and maintainability.

Reusing HTTP sessions: The script creates a new HTTP session for each request. This is not necessary and can be improved by reusing the session.

Configuration variables: The script uses global variables for configuration. It would be better to encapsulate them into a configuration class or a configuration file.

Error handling: The script only logs the status of the server and whether the reboot was successful or not. It would be good to add more error handling, for example, if the server does not return a JSON response.

Internationalization: The script uses both English and Russian in the logs. It would be better to stick to one language for consistency.

MrCheatEugene commented 1 year ago

Looks great.

MrCheatEugene commented 1 year ago

Возможен конфликт. Плиз, можешь сделать то же самое, но оттолкнувшись от текущей версии?(табы теперь заменены на пробелы, а " на ')