Created
January 7, 2018 20:26
-
-
Save l1m2p3/050dc924fc942c4b017c18e9b9bcfb1f to your computer and use it in GitHub Desktop.
Sample script to invoke Lambda function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| import json | |
| from datetime import datetime | |
| from pytz import timezone | |
| lambda_client = boto3.client('lambda') | |
| print('invoking') | |
| # invoke | |
| event = { | |
| 'input': 'this is a very very positive review', | |
| } | |
| event = json.dumps(event) | |
| response = lambda_client.invoke( | |
| FunctionName = 'pytorch_on_lambda', | |
| InvocationType = 'RequestResponse', | |
| Payload = event | |
| ) | |
| print(response['StatusCode']) | |
| print(response['Payload'].read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment