Best Python code snippet using localstack_python
provider.py
Source:provider.py
...146 cache = sns_backend.platform_endpoint_messages[target_arn] = (147 sns_backend.platform_endpoint_messages.get(target_arn) or []148 )149 cache.append(req_data)150 platform_app, endpoint_attributes = get_attributes_for_application_endpoint(target_arn)151 message_structure = req_data.get("MessageStructure", [None])[0]152 LOG.debug("Publishing message to Endpoint: %s | Message: %s", target_arn, message)153 start_thread(154 lambda _: message_to_endpoint(155 target_arn,156 message,157 message_structure,158 endpoint_attributes,159 platform_app,160 )161 )162 return message_id163 LOG.debug("Publishing message to TopicArn: %s | Message: %s", topic_arn, message)164 start_thread(165 lambda _: message_to_subscribers(166 message_id,167 message,168 topic_arn,169 # TODO: check170 req_data,171 headers,172 subscription_arn,173 skip_checks,174 message_attributes,175 )176 )177 return message_id178def get_attributes_for_application_endpoint(target_arn):179 sns_client = aws_stack.connect_to_service("sns")180 app_name = target_arn.split("/")[-2]181 endpoint_attributes = None182 try:183 endpoint_attributes = sns_client.get_endpoint_attributes(EndpointArn=target_arn)[184 "Attributes"185 ]186 except botocore.exceptions.ClientError:187 LOG.warning(f"Missing attributes for endpoint: {target_arn}")188 if not endpoint_attributes:189 raise CommonServiceException(190 message="No account found for the given parameters",191 code="InvalidClientTokenId",192 status_code=403,...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!