def run(redis_uri, interface, port, prefix, logfile, debug): from .main import PortiaServer from twisted.internet import reactor from twisted.python import log from txredisapi import Connection log.startLogging(logfile) d = Connection(redis_uri.hostname, int(redis_uri.port or 6379), int(redis_uri.path[1:])) d.addCallback( lambda redis: PortiaServer(redis, prefix=prefix, debug=debug)) d.addCallback(lambda portia: portia.app.run(interface, port)) reactor.run()
def import_porting_db(redis_uri, prefix, logfile, debug, header, file): from .portia import Portia from twisted.internet.task import react from twisted.python import log from txredisapi import Connection log.startLogging(logfile) d = Connection(redis_uri.hostname, int(redis_uri.port or 6379), int(redis_uri.path[1:])) d.addCallback(lambda redis: Portia(redis, prefix=prefix)) d.addCallback(lambda portia: portia.import_porting_file(file, header)) d.addCallback(lambda msisdns: [log.msg('Imported %s' % (msisdn, )) for msisdn in msisdns]) react(lambda _reactor: d)
def import_porting_db(redis_uri, prefix, logfile, debug, header, file): from .portia import Portia from twisted.internet.task import react from twisted.python import log from txredisapi import Connection log.startLogging(logfile) d = Connection(redis_uri.hostname, int(redis_uri.port or 6379), int(redis_uri.path[1:])) d.addCallback(lambda redis: Portia(redis, prefix=prefix)) d.addCallback(lambda portia: portia.import_porting_file(file, header)) d.addCallback( lambda msisdns: [ log.msg('Imported %s' % (msisdn,)) for msisdn in msisdns]) react(lambda _reactor: d)