Solution: Web client



examples/web_client/lambda_function.py
import json
import sys

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

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 'url' not in event['queryStringParameters']:
        return {
            'statusCode': 400,
            'headers': { 'Content-Type': 'application/json' },
            'body': json.dumps({ 'error': 'Missing field' })
        }

    r = requests.get(event['queryStringParameters']['url'])

    return {
        'statusCode': 200,
        'headers': { 'Content-Type': 'application/json' },
        'body': json.dumps({
            'url' : event['queryStringParameters']['url'],
            'content': r.text,
        })
    }

examples/web_client/requirements.txt
requests

examples/web_client/setup.cfg
[install]
prefix=

pip install -r requirements.txt -t pypi
zip -r ../project.zip *


curl 'https://qspmdah6oj.execute-api.us-east-1.amazonaws.com/v0/hello?url=https://httpbin.org/get'