class JsonRPC: def __init__(self): self.connection = ServiceConnection("127.0.0.1:8082") self.template = '{"jsonrpc":"2.0","id":"1","method":"%s","params":%s}' self.url_template = "/jsonrpc" self.hdrs = {"Content-Type": "application/json"} def method(self, method, params): body = self.template % (method, json.dumps(params)) resp = self.connection.getData( self.url_template, headers=self.hdrs, data=body) return json.loads(resp)
def __init__(self): self.connection = ServiceConnection("127.0.0.1:8082") self.template = '{"jsonrpc":"2.0","id":"1","method":"%s","params":%s}' self.url_template = "/jsonrpc" self.hdrs = {"Content-Type": "application/json"}
def __init__(self): self.items_per_page = 11 ServiceConnection.__init__(self, TWITCH_HOST, https=True)