def __init__(self, cfg_file=None): """ Loads our settings from django.conf.settings, applying defaults for a that are omitted. """ if (cfg_file is None): if hasattr(settings, 'AADHAAR_CONFIG_FILE'): cfg_file = settings.AADHAAR_CONFIG_FILE if cfg_file == None or not (os.path.isfile(cfg_file)): raise Exception("AADHAAR_CONFIG_FILE is either undefined or does not exist") # Load it up... c = AuthConfig(cfg=cfg_file) self.cfg = c.update_config()
def __init__(self): """ Loads our settings from django.conf.settings, applying defaults for a that are omitted. """ from django.conf import settings for name, default in self.defaults.iteritems(): value = getattr(settings, name, default) setattr(self, name, value) cfg_file = getattr(self, 'AADHAAR_CONFIG_FILE') if cfg_file == None or not (os.path.isfile(cfg_file)): raise Exception("AADHAAR_CONFIG_FILE is either undefined or does not exist") c = AuthConfig(cfg=cfg_file) self.cfg = c.update_config()
# Load the response data = json.loads(req.export_response_data()) res = AuthResponse(cfg=cfg, uid=cfg.request.uid) res.load_string(data['xml']) # Find all the attributes set bits = res.lookup_usage_bits() print "[%.3f] (%s) -> %s " % (data['latency'], bits, data['ret']) if data['err'] is not None and data['err'] != -1: print "Err %s: %s "% ( data['err'], data['err_message']) if __name__ == '__main__': logging.basicConfig() cmd = AuthConfig('batch', "Batch processing") cfg = cmd.update_config() #=> Setup logging logging.getLogger().setLevel(logging.WARN) #cfg.common.loglevel ) logging.basicConfig( #filename='execution.log', format='%(asctime)-6s: %(name)s - %(levelname)s - %(message)s') log.info("Starting my Batch AuthClient") batch = AuthBatchRequest(cfg=cfg) batch.load_data() batch.authenticate_basic() batch.authenticate_advanced()
from AadhaarAuth.data import AuthData from AadhaarAuth.command import AuthConfig from AadhaarAuth.response import AuthResponse __author__ = "Venkata Pingali" __copyright__ = "Copyright 2011,Venkata Pingali and TCS" __credits__ = ["UIDAI", "MindTree", "GeoDesic", "Viral Shah"] __license__ = "MIT" __version__ = "0.1" __maintainer__ = "Venkata Pingali" __email__ = "*****@*****.**" __status__ = "Pre-release" if __name__ == '__main__': cmd = AuthConfig() cfg = cmd.update_config() logging.getLogger().setLevel(cfg.common.loglevel) logging.basicConfig() # This is a simple client. Force use of name cfg.request.demographics = ["Pi"] cfg.request.biometrics = [] # => Gather the data from the (simulated) client data = AuthData(cfg=cfg) data.generate_client_xml() exported_data = data.export_request_data() # Create the request object and execute