Best Python code snippet using localstack_python
provider.py
Source:provider.py  
...79    def on_get(self, request):80        return {81            "messages": list(EMAILS.values()),82        }83def register_ses_api_resource():84    """Register the email retrospection endpoint as an internal LocalStack endpoint."""85    # Use a global to indicate whether the resource has already been registered86    # This is cheaper than iterating over the registered routes in the Router object87    global _EMAILS_ENDPOINT_REGISTERED88    if not _EMAILS_ENDPOINT_REGISTERED:89        get_internal_apis().add(EMAILS_ENDPOINT, SesServiceApiResource())90        _EMAILS_ENDPOINT_REGISTERED = True91class SesProvider(SesApi, ServiceLifecycleHook):92    #93    # Lifecycle Hooks94    #95    def on_after_init(self):96        # Allow sent emails to be retrieved from the SES emails endpoint97        register_ses_api_resource()98    #99    # Helpers100    #101    def get_source_from_raw(self, raw_data: str) -> Optional[str]:102        """Given a raw representation of email, return the source/from field."""103        entities = raw_data.split("\n")104        for entity in entities:105            if "From:" in entity:106                return entity.replace("From:", "").strip()107        return None108    #109    # Implementations for SES operations110    #111    @handler("ListTemplates")...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!!
