def get_data(timeperiod, src, newstype, limit):
    data = (
        get_Query(Data).filter('datetime >', timeperiod)
        .filter('src =', src).filter('newstype =', newstype)
        .fetch(limit = limit)
        )
    return data
Beispiel #2
0
def count_posts(newstype, srckey, hours, minutes):
    global increment    
    min2 = 0    
    if minutes > 0:
        min2 = minutes - increment    
    count = (
             get_Query(Post)._filter('newstype =', newstype)._filter('srckey =', srckey)
             ._filter('pubDate >', datetime.now(GMT2()) - timedelta(hours = hours))
             ._filter('pubDate >', datetime.now(GMT2()) - timedelta(minutes = minutes))
             ._filter('pubDate <', datetime.now(GMT2()) - timedelta(minutes = min2))
             .count(limit = None)
            )
    return count