Last active
July 2, 2019 21:45
-
-
Save admiral0/77f631239940adc4f6e7b507274d7a77 to your computer and use it in GitHub Desktop.
This file contains 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 json | |
import boto3 | |
from datetime import datetime | |
ddb = boto3.client('dynamodb') | |
def lambda_handler(event, context): | |
today = datetime.utcnow().strftime('%d%m%Y') | |
try: | |
lulz = ddb.get_item(TableName='morti-di-stima', Key={'data': {'S': today}})['Item']['morti']['S'] | |
except: | |
lulz = 0 | |
res = '<h1>' + lulz + '</h1>' | |
res += ''' | |
<form action="/" method="post"> | |
<input type="submit" value="RIP (+1 morte)"/> | |
</form> | |
''' | |
return { | |
"statusCode": 200, | |
"body": res, | |
"headers": { | |
'Content-Type': 'text/html', | |
} | |
} |
This file contains 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 json | |
import boto3 | |
from datetime import datetime | |
ddb = boto3.client('dynamodb') | |
def lambda_handler(event, context): | |
today = datetime.utcnow().strftime('%d%m%Y') | |
try: | |
lulz = int(ddb.get_item(TableName='morti-di-stima', Key={'data': {'S': today}})['Item']['morti']['S']) | |
except: | |
lulz = 0 | |
lulz += 1 | |
ddb.put_item(TableName='morti-di-stima', Item={ | |
'data':{ | |
'S': today, | |
}, | |
'morti': { | |
'S': str(lulz) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment