Example #1
0
#!/usr/bin/env python
from datetime import datetime

__author__ = "*****@*****.**"

# this scripts removes garbage from database

import sys

sys.path.append("../model")
sys.path.append("../logic")

from OAuth import OAuthRequestToken
from Constants import Settings

query = OAuthRequestToken.all().filter("created <", datetime.now() - Settings["EXPIRATION_WINDOW"])
count = query.count(Settings["CLEANUP_BATCH_SIZE"])
db.delete(query.fetch(Settings["CLEANUP_BATCH_SIZE"]))