Esempio n. 1
0
 def getGeoInfor(self):
     raw_geo_string = self.get_secure_cookie(self.USER_SESSION_GEO_INFO)
     geo_info = {}
     if raw_geo_string is not None:
         try:
             geo_info = json.loads(ensureString(raw_geo_string))
         except Exception as e:
             HornerFileLogging.getLogger().error(str(e))
     return geo_info
Esempio n. 2
0
 def doParse(self, sInformation):
     try:
         geo_information = json.loads(ensureString(sInformation))
         if isinstance(geo_information, dict) and (0 == geo_information.get('status', -1)):
             _address = geo_information.get('address', '')
             _address_content = geo_information.get('content', {})
             if isinstance(_address_content, dict):
                 _address_detail = _address_content.get('address_detail', '')
                 if isinstance(_address_detail, dict):
                     if isinstance(_address_detail, dict):
                         self.province = _address_detail.get('province', '')
                         self.city = _address_detail.get('city', '')
             _address_code_array = _address.split('|')
             self.net_catalog = _address_code_array[4] if 5 < len(_address_code_array) else ''
     except Exception as e:
         HornerFileLogging.getLogger().error(str(e))
     return {
         'net': self.net_catalog,
         'province': self.province,
         'city': self.city
     }