Exemplo n.º 1
0
 def __post(self, method, debug_mode=False, **data):
     url = '/'.join((self.url, method))
     key, xml = data.keys()[0], StringIO()
     to_xml(xml, data[key], format=self.format_xml)
     data = (key, xml.getvalue())
     if debug_mode: debug('\n%s', data[1])
     data = urllib.urlencode((data, ))
     try:
         response = urllib2.urlopen(url, data).read()
         return EndiciaResponse(response)
     except urllib2.HTTPError, e:
         debug(e)
         return None
Exemplo n.º 2
0
 def __post2(self, method, debug_mode=False, **data):
     url = 'https://www.endicia.com/ELS/ELSServices.cfc'
     key, xml = data.keys()[0], StringIO()
     to_xml(xml, data[key], format=self.format_xml)
     data = (key, xml.getvalue())
     if debug_mode: debug('\n%s', data[1])
     data = urllib.urlencode((('Method', method), data))
     if debug_mode: debug(data)
     try:
         response = urllib2.urlopen(url, data).read()
         return EndiciaResponse(response)
     except urllib2.HTTPError, e:
         debug(e)
         return None