When working with APIs, we have the one API-object:
class API:
def __init__(self, sub=None):
self.sub = sub
def get_api(self, name):
return build(name, sub=self.sub) #custom
All api-calls we want to support are added as class-funtions along with the exception-handling.
def event_delete(self, *args, **kwargs):
return query_backoff(self.get_api("calendar").events().delete(*args, **kwargs))
def student_list(self, *args, **kwargs):
reutrn query_backoff(self.get_api("classroom").courses().students().list(*args, **kwargs))
def member_get(self, *args, **kwargs):
try:
return query_backoff(self.get_api("admin_directory").members().get(*args, **kwargs))
except ...
This file has grown to thousands of lines of python-code. I want to split it into multiple files. I don't know how to do this, as they are class-functions.