Best Python code snippet using localstack_python
ses_identities.py
Source:ses_identities.py  
...78            logger.exception("Couldn't get status for %s.", identity)79            raise80        else:81            return status82    def delete_identity(self, identity):83        """84        Deletes an identity.85        :param identity: The identity to remove.86        """87        try:88            self.ses_client.delete_identity(Identity=identity)89            logger.info("Deleted identity %s.", identity)90        except ClientError:91            logger.exception("Couldn't delete identity %s.", identity)92            raise93    def list_identities(self, identity_type, max_items):94        """95        Gets the identities of the specified type for the current account.96        :param identity_type: The type of identity to retrieve, such as EmailAddress.97        :param max_items: The maximum number of identities to retrieve.98        :return: The list of retrieved identities.99        """100        try:101            response = self.ses_client.list_identities(102                IdentityType=identity_type, MaxItems=max_items)103            identities = response['Identities']104            logger.info("Got %s identities for the current account.", len(identities))105        except ClientError:106            logger.exception("Couldn't list identities for the current account.")107            raise108        else:109            return identities110def usage_demo():111    print('-'*88)112    print("Welcome to the Amazon Simple Email Service (Amazon SES) identities demo!")113    print('-'*88)114    logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s')115    ses_identity = SesIdentity(boto3.client('ses'))116    email = input(117        "Enter an email address to verify with Amazon SES. This address will "118        "receive a verification email: ")119    ses_identity.verify_email_identity(email)120    print(f"Follow the steps in the email to {email} to complete verification.")121    print("Waiting for verification...")122    try:123        ses_identity.wait_until_identity_exists(email)124        print(f"Identity verified for {email}.")125    except WaiterError:126        print(f"Verification timeout exceeded. You must complete the "127              f"steps in the email sent to {email} to verify the address.")128    identities = ses_identity.list_identities('EmailAddress', 10)129    print("The identities in the account are:")130    print(*identities, sep='\n')131    status = ses_identity.get_identity_status(email)132    print(f"{email} has status: {status}.")133    answer = input(f"Do you want to remove {email} from Amazon SES (y/n)? ")134    if answer.lower() == 'y':135        ses_identity.delete_identity(email)136        print(f"{email} removed from Amazon SES.")137    print("Thanks for watching!")138    print('-'*88)139if __name__ == '__main__':...test_identities.py
Source:test_identities.py  
...40            container = factories.IdentityFactory.build_protobuf()41            container.ClearField('user_id')42            self.client.call_action('delete_identity', identity=container)43    @mock.patch('users.actions.providers.Google')44    def test_delete_identity(self, mock_provider):45        user = factories.UserFactory.create()46        identity = factories.IdentityFactory.create_protobuf(47            user=user,48            provider=user_containers.IdentityV1.GOOGLE,49        )50        self.client.call_action('delete_identity', identity=identity)...ses_services.py
Source:ses_services.py  
...27      MaxItems=max_item28    )29    return response30def delete_identity_address(ses,email_adrress):31    response = ses.delete_identity(32      Identity = email_adrress33    )34    return response35def delete_identity_domain(ses,domain_name):36    response = ses.delete_identity(37      Identity = domain_name38    )39    return response...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!!
