Skip to content

Instantly share code, notes, and snippets.

@bee-san
Created February 6, 2021 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bee-san/69ad132e1d2e6989a332aafcc1763c4a to your computer and use it in GitHub Desktop.
Save bee-san/69ad132e1d2e6989a332aafcc1763c4a to your computer and use it in GitHub Desktop.
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