ServiceBase
class ServiceBase(object):
def __init__(self, host, vpath, headers: dict = None):
self.host = host
self.vpath = vpath
self.headers = headers
def before_request(self):
pass
def after_request(self):
pass
def _get(self, url=None, param=None, **kwargs):
return requests.get(url=url, params=param, **kwargs)
def _post(self, url=None, json=None, data=None, **kwargs):
return requests.post(url=url, json=json, data=data, **kwargs)