Пример #1
0
def main():
  adaptive = Adaptive()
  tweet_items = adaptive.fetch_data()

  with DataStore() as ds:

    if tweet_items:
      ds.insert_tweets(tweet_items)
    else:
      print "no results from adaptive api"

    all_tweets = ds.get_all_tweets()

    for t in all_tweets:
        print t
Пример #2
0
def index():
    """
    Each time called, retieve the latest set of data from the adaptive api.
    If data returned, store the new data and then fetch all tweets, before rendeering the results.
    """
    adaptive = Adaptive()
    tweet_items = adaptive.fetch_data()

    if tweet_items:
        with DataStore() as ds:
            ds.insert_tweets(tweet_items)

            tweet_list = ds.get_all_tweets()

        result = render_template("index.html", tweet_list=tweet_list, error_message="")
    else:
        result = render_template("index.html", tweet_list=[], error_message="No Results, Folks!")

    return result
Пример #3
0
def index():
    """
    Each time called, retieve the latest set of data from the adaptive api.
    If data returned, store the new data and then fetch all tweets, before rendeering the results.
    """
    adaptive = Adaptive()
    tweet_items = adaptive.fetch_data()

    if tweet_items:
        with DataStore() as ds:
            ds.insert_tweets(tweet_items)

            tweet_list = ds.get_all_tweets()

        result = render_template('index.html',
                                 tweet_list=tweet_list,
                                 error_message='')
    else:
        result = render_template('index.html',
                                 tweet_list=[],
                                 error_message='No Results, Folks!')

    return result