Third party not pure-python



examples/app_editdistance/lambda_function.py
import json
import sys

sys.path.insert(0, 'pypi')
import editdistance

def lambda_handler(event, context):
    if 'queryStringParameters' not in event:
        return {
            'statusCode': 500,
            'headers': { 'Content-Type': 'application/json' },
            'body': json.dumps({ 'error': 'Missing queryStringParameters' })
        }
        
    
    if event['queryStringParameters'] == None or 'a' not in event['queryStringParameters'] or 'b' not in event['queryStringParameters']:
        return {
            'statusCode': 400,
            'headers': { 'Content-Type': 'application/json' },
            'body': json.dumps({ 'error': 'Missing field' })
        }

    distance = editdistance.eval(event['queryStringParameters']['a'], event['queryStringParameters']['b'])

    return {
        'statusCode': 200,
        'headers': { 'Content-Type': 'application/json' },
        'body': json.dumps({
            'a' : event['queryStringParameters']['a'],
            'b' : event['queryStringParameters']['b'],
            'editdistance': distance,
        })
    }

if __name__ == '__main__':
    print(lambda_handler({
       'queryStringParameters': {
          'a': 'xyz',
          'b': 'xrp',
       }
    }, {}))

examples/app_editdistance/requirements.txt
editdistance