def create_api_with_publickey(storage, forceGetCert=False): api = ClientAPI() api.set_public_key(*_get_public_key(storage, forceGetCert)) return api
def _get_public_key(): from simple_rsa import get_public_key cert = ClientAPI().get_cert()[0] return get_public_key(cert)
def _get_public_key(storage, forceGetCert=False): cert = storage.get('cert', '') if forceGetCert or cert == '': cert = ClientAPI().get_cert()[0] storage['cert'] = cert return get_public_key(cert)
def creaet_api_with_publickey(): api = ClientAPI() api.set_public_key(*_get_public_key()) return api