"""Fetching data GAE with protocol buffer calls. It uses
a timestamp field to query for time ranges.  By default,
that property is the "backup_timestamp" property used
by backup_model.BackupModel.
"""

import datetime as dt
import optparse
import pickle
import sys
import time
import urllib
import urllib2

import gae_util
gae_util.fix_sys_path()

from google.appengine.api import datastore
from google.appengine.datastore import entity_pb

import date_util
import oauth_util.fetch_url


# TODO(benkomalo): rename "max_logs" to max_results or something.
def fetch_entities(entity_type, is_ndb, start_date=None, end_date=None,
                   max_logs=None, index_name=None):
    """Makes a request to the main Khan Academy server to download entities.

    Arguments:
        entity_type: The appengine "Kind" for the entity to download.
Example #2
0
"""Fetching data GAE with protocol buffer calls. It uses
a timestamp field to query for time ranges.  By default,
that property is the "backup_timestamp" property used
by backup_model.BackupModel.
"""

import datetime as dt
import optparse
import pickle
import sys
import time
import urllib
import urllib2

import gae_util
gae_util.fix_sys_path()

from google.appengine.api import datastore
from google.appengine.datastore import entity_pb

import date_util
import notify
import oauth_util.fetch_url
from util import get_logger

g_logger = get_logger()


# TODO(benkomalo): rename "max_logs" to max_results or something.
def fetch_entities(entity_type,
                   is_ndb,