def print_labels(self, cr, uid, ids, b64_data, data_format="epl2", context=None): if not b64_data: return False for company in self.browse(cr, uid, ids, context=context): api = HttpClient( url=company.printer_proxy_url, username=company.printer_proxy_username, password=company.printer_proxy_password ) api.call("output", printer_name=company.printer_proxy_device_name, data=b64_data, format=data_format) return True
def call(self, method, *args, **kwargs): provider = self.registry.get_random_provider(self.interface, version=self.version, group=self.group) client = HttpClient(url="http://{0}{1}".format(provider.location, provider.path)) try: return client.call(method, *args, **kwargs) except HTTPError, e: raise ConnectionFail(None, e.filename)
def call(self, method, *args, **kwargs): provides = self.registry.get_provides(self.interface, version=self.version, group=self.group) if len(provides) == 0: raise NoProvider('can not find provide', self.interface) ip_port, service_url = random.choice(provides.items()) # print service_url.location client = HttpClient(url="http://{0}{1}".format(ip_port, service_url.path)) try: return client.call(method, *args, **kwargs) except HTTPError, e: raise ConnectionFail(None, e.filename)
def call(self, method, *args, **kwargs): provides = self.registry.get_provides(self.interface, version=self.version, group=self.group) if len(provides) == 0: raise NoProvider('can not find provide', self.interface) ip_port, service_url = random.choice(provides.items()) # print service_url.location client = HttpClient( url="http://{0}{1}".format(ip_port, service_url.path)) try: return client.call(method, *args, **kwargs) except HTTPError, e: raise ConnectionFail(None, e.filename)