Created
February 6, 2021 23:20
-
-
Save bee-san/69ad132e1d2e6989a332aafcc1763c4a 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
C='TTL' | |
B='Uses' | |
import boto3 | |
G=boto3.resource('dynamodb') | |
def A(event,context): | |
L='Hash';K=event[L];C=G.Table('hash_lookup');D={} | |
for E in K: | |
A=C.get_item(Key={L:E})['Item'] | |
if not A['Verified']:F=H(A);C.put_item(Item=F) | |
if B in A:A[B]=A[B]+1 | |
else:A[B]=1 | |
C.put_item(Item=A);A=I(A);D[E]=A | |
return{'statusCode':200,'body':D} | |
def H(row): | |
A=row | |
if A[B]>=5: | |
if C in A:del A[C] | |
return A | |
def I(row): | |
A=row | |
if C in A:del A[C] | |
if B in A:del A[B] | |
return A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment