Each api call in each class currently repeats a lot of the same code over and over. Using a decorator function could easily reduce the number of instances of the repeating code to one. This will be especially easy to do if https://github.com/N4S4/synology-api/issues/9 is implemented.
The decorator function would be defined as a method in the "Authentication" class:
def api_call(self, function):
...
and then can be used in each other class as so:
class DownloadStation(Authentication):
@self.api_call
def get_info(self):
...
Writing new methods and changing existing ones becomes much easier.
See this issue first: https://github.com/N4S4/synology-api/issues/7
Each api call in each class currently repeats a lot of the same code over and over. Using a decorator function could easily reduce the number of instances of the repeating code to one. This will be especially easy to do if https://github.com/N4S4/synology-api/issues/9 is implemented.
The decorator function would be defined as a method in the "Authentication" class:
and then can be used in each other class as so:
Writing new methods and changing existing ones becomes much easier.