summarypip packages
linesdk
push data for line and slack
| import traceback | |
| traceback.format_exc() |
| setattr(cls, func.__name__, wrapper) |
| name="my-env" | |
| version="3.7" | |
| # Create a new conda environment for the given Python version | |
| conda create -y -n "$name" python="$version" | |
| # Activate the environment | |
| source /home/ec2-user/anaconda3/bin/activate "$name" | |
| # Create a Jupyter kernel for your new environment |
| def helpme(): | |
| print('help') | |
| # unit test function | |
| def testAddTransaction(testData, expectedResponse): | |
| result = addTransaction(testData, '') | |
| # check if status code is the same | |
| assert result['statusCode'] == expectedResponse['statusCode'], f"status code is incorrect, it should be {expectedResponse['statusCode']}, {result}" | |
| # check if transaction id is the same | |
| if result.get('transactionId'): |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: > | |
| Sample SAM Template for dax-demo | |
| Globals: | |
| Function: | |
| Timeout: 3 | |
| Resources: |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Transform: AWS::Serverless-2016-10-31 | |
| Description: > | |
| villa-search-2 | |
| Sample SAM Template for villa-search-2 | |
| Globals: | |
| Function: | |
| Timeout: 3 |
| DeepleSearchApi: | |
| Type: AWS::Serverless::Api | |
| Properties: | |
| StageName: Prod | |
| Auth: | |
| DefaultAuthorizer: AWS_IAM | |
| EndpointConfiguration: | |
| Type: EDGE | |
| MethodSettings: | |
| CachingEnabled: True |
| class Lambda: | |
| ''' | |
| for invoking lambda functions | |
| ''' | |
| def __init__(self, user=None, pw=None, region = 'ap-southeast-1'): | |
| self.lambdaClient = boto3.client( | |
| 'lambda', | |
| aws_access_key_id=user, | |
| aws_secret_access_key=pw, | |
| region_name = region |