Skip to content

Instantly share code, notes, and snippets.

@liezl200
Last active August 29, 2015 14:13
Show Gist options
  • Save liezl200/2d6116e7dcd77402ec62 to your computer and use it in GitHub Desktop.
Save liezl200/2d6116e7dcd77402ec62 to your computer and use it in GitHub Desktop.
datetime
import datetime
#IN THE MODEL
class Transaction(ndb.Model):
address = ndb.StringProperty(required=True)
ndb.FloatProperty(required=True)
timestamp = ndb.DateTimeProperty(required=True)
#USAGE IN A HANDLER
t = Transaction(address=a.address, tAmt=a.balance, timestamp=datetime.datetime.now())
t.put()
#QUERYING AND DETERMINING
ttime = t.timestamp
expiry = datetime.timedelta(minutes=60) + ttime
if curr >= expiry:
t.key.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment