Esempio n. 1
0
    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
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)