Best Python code snippet using localstack_python
service_models.py
Source:service_models.py
...93 state = self.fetch_state(*args, **kwargs)94 self.update_state(state)95 return state96 except Exception as e:97 if not template_deployer.check_not_found_exception(98 e, self.resource_type, self.properties99 ):100 LOG.debug("Unable to fetch state for resource %s: %s" % (self, e))101 def fetch_state_if_missing(self, *args, **kwargs):102 if not self.state:103 self.fetch_and_update_state(*args, **kwargs)104 return self.state105 def set_resource_state(self, state):106 """Set the deployment state of this resource."""107 self.state = state or {}108 def update_state(self, details):109 """Update the deployment state of this resource (existing attributes will be overwritten)."""110 details = details or {}111 self.state.update(details)...
handlers.py
Source:handlers.py
1from fastapi import APIRouter, Request, Depends2from sqlalchemy.ext.asyncio import AsyncSession3from core.exceptions import (ValidationException, CredentialException,4 ForbiddenException, NotFoundException)5from db.base import get_session6router = APIRouter()7@router.get("/check_validation_error")8async def check_validation_error_handler(9 request: Request,10 session: AsyncSession = Depends(get_session),11):12 raise ValidationException()13@router.get("/check_credentials_exception")14async def check_credentials_exception_handler(15 request: Request,16 session: AsyncSession = Depends(get_session),17):18 raise CredentialException()19@router.get("/check_forbidden_exception")20async def check_forbidden_exception_handler(21 request: Request,22 session: AsyncSession = Depends(get_session),23):24 raise ForbiddenException()25@router.get("/check_not_found_exception")26async def check_not_found_exception_handler(27 request: Request,28 session: AsyncSession = Depends(get_session),29):...
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!!