from __future__ import absolute_import, print_function

import datetime
import itertools

from streamparse.spout import Spout


class SimpleSimulationSpout(Spout):
    urls = [
        'http://www.parsely.com/',
        'http://streamparse.readthedocs.org/',
        'https://pypi.python.org/pypi/streamparse',
    ]

    def initialize(self, stormconf, context):
        self.url_seq = itertools.cycle(self.urls)

    def next_tuple(self):
        url = next(self.url_seq)
        timestamp = datetime.datetime.now().isoformat()
        self.emit([url, timestamp])

from __future__ import absolute_import, print_function

import datetime
import itertools

from streamparse.spout import Spout


class SimpleSimulationSpout(Spout):
    terms = [
        'real-time analytics',
        'apache storm',
        'pypi',
    ]

    def initialize(self, stormconf, context):
        self.term_seq = itertools.cycle(self.terms)

    def next_tuple(self):
        term = next(self.term_seq)
        timestamp = datetime.datetime.now().isoformat()
        self.emit([term, timestamp])

Change simulation to search terms.
Change simulation to search terms.

  from __future__ import absolute_import, print_function
  
  import datetime
  import itertools
  
  from streamparse.spout import Spout
  
  
  class SimpleSimulationSpout(Spout):
-     urls = [
+     terms = [
-         'http://www.parsely.com/',
-         'http://streamparse.readthedocs.org/',
-         'https://pypi.python.org/pypi/streamparse',
+         'real-time analytics',
+         'apache storm',
+         'pypi',
      ]
  
      def initialize(self, stormconf, context):
-         self.url_seq = itertools.cycle(self.urls)
+         self.term_seq = itertools.cycle(self.terms)
  
      def next_tuple(self):
-         url = next(self.url_seq)
+         term = next(self.term_seq)
          timestamp = datetime.datetime.now().isoformat()
-         self.emit([url, timestamp])
+         self.emit([term, timestamp])
  
Change simulation to search terms.
## Code Before:
from __future__ import absolute_import, print_function

import datetime
import itertools

from streamparse.spout import Spout


class SimpleSimulationSpout(Spout):
    urls = [
        'http://www.parsely.com/',
        'http://streamparse.readthedocs.org/',
        'https://pypi.python.org/pypi/streamparse',
    ]

    def initialize(self, stormconf, context):
        self.url_seq = itertools.cycle(self.urls)

    def next_tuple(self):
        url = next(self.url_seq)
        timestamp = datetime.datetime.now().isoformat()
        self.emit([url, timestamp])

## Instruction:
Change simulation to search terms.
## Code After:
from __future__ import absolute_import, print_function

import datetime
import itertools

from streamparse.spout import Spout


class SimpleSimulationSpout(Spout):
    terms = [
        'real-time analytics',
        'apache storm',
        'pypi',
    ]

    def initialize(self, stormconf, context):
        self.term_seq = itertools.cycle(self.terms)

    def next_tuple(self):
        term = next(self.term_seq)
        timestamp = datetime.datetime.now().isoformat()
        self.emit([term, timestamp])
