def connect(self):
    connection = None
    try:
        endpoint_url = self.config.SQS_ENDPOINT
        profile = (os.environ['AWS_PROFILE'] if ('AWS_PROFILE' in os.environ) else None)
        self.logger.info('SQSEvents - profile: {}'.format(profile))
        self.logger.info('SQSEvents - endpoint_url: {}'.format(endpoint_url))
        self.logger.info('SQSEvents - self.config.REGION_NAME: {}'.format(self.config.REGION_NAME))
        if profile:
            session = boto3.session.Session(profile_name=profile)
            connection = session.resource('sqs', endpoint_url=endpoint_url, region_name=self.config.REGION_NAME)
        else:
            connection = boto3.resource('sqs', endpoint_url=endpoint_url, region_name=self.config.REGION_NAME)
        self.logger.info('SQSEvents - Connected')
    except Exception as err:
        self.logger.error(err)
    return connection
def connect(self):
    connection = None
    try:
        endpoint_url = self.config.SQS_ENDPOINT
        profile = (os.environ['AWS_PROFILE'] if ('AWS_PROFILE' in os.environ) else None)
        self.logger.info('SQSEvents - profile: {}'.format(profile))
        self.logger.info('SQSEvents - endpoint_url: {}'.format(endpoint_url))
        self.logger.info('SQSEvents - self.config.REGION_NAME: {}'.format(self.config.REGION_NAME))
        if profile:
            session = boto3.session.Session(profile_name=profile)
            connection = session.resource('sqs', endpoint_url=endpoint_url, region_name=self.config.REGION_NAME)
        else:
            connection = boto3.resource('sqs', endpoint_url=endpoint_url, region_name=self.config.REGION_NAME)
        self.logger.info('SQSEvents - Connected')
    except Exception as err:
        self.logger.error(err)
    return connection