コード例 #1
0
class ClientsRepository:
    def __init__(self, enviroment, clients_table, url2scan_table, config):
        self.enviroment = enviroment
        self.clients_table = clients_table
        self.url2scan_table = url2scan_table
        self.channel_factory = ChannelFactory(config)

    def get_client(self, client_id):
        clients = self.clients_table.query(KeyConditionExpression= \
                                Key('enviroment').eq(self.enviroment) & \
                                Key('client_id').eq(client_id))
        return clients['Items'][0]

    def get_client_urls(self, client_id):
        urls = self.url2scan_table.query(
            KeyConditionExpression=Key('client_id').eq(client_id))
        return urls['Items']

    def get_clients(self):
        clients = self.clients_table.query(KeyConditionExpression= \
                                          Key('enviroment').eq(self.enviroment))
        return clients['Items']

    def get_client_channels(self, client_id):
        client = self.get_client(client_id)
        email_channel = self.channel_factory.newEmailChannel(client['email'])
        return [email_channel]
コード例 #2
0
class ClientsRepository:
    def __init__(self, enviroment, clients_table, url2scan_table, config):
        self.enviroment = enviroment
        self.clients_table = clients_table
        self.url2scan_table = url2scan_table
        self.channel_factory = ChannelFactory(config)

    def get_client(self, client_id):
        clients = self.clients_table.query(KeyConditionExpression= \
                                Key('enviroment').eq(self.enviroment) & \
                                Key('client_id').eq(client_id))
        return clients['Items'][0]

    def get_client_urls(self, client_id):
        urls = self.url2scan_table.query(KeyConditionExpression=Key('client_id').eq(client_id))
        return urls['Items']

    def get_clients(self):
        clients = self.clients_table.query(KeyConditionExpression= \
                                          Key('enviroment').eq(self.enviroment))
        return clients['Items']

    def get_client_channels(self, client_id):
        client = self.get_client(client_id)
        email_channel = self.channel_factory.newEmailChannel(client['email'])
        return [email_channel]
コード例 #3
0
 def __init__(self, enviroment, clients_table, url2scan_table, config):
     self.enviroment = enviroment
     self.clients_table = clients_table
     self.url2scan_table = url2scan_table
     self.channel_factory = ChannelFactory(config)
コード例 #4
0
 def __init__(self, enviroment, clients_table, url2scan_table, config):
     self.enviroment = enviroment
     self.clients_table = clients_table
     self.url2scan_table = url2scan_table
     self.channel_factory = ChannelFactory(config)