title: How to collect stats from within scrapy spider callback?
body: <p>How can I collect stats from within a spider callback?</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>class MySpider(Spider):
       name = "myspider"
       start_urls = ["http://example.com"]
  
  def parse(self, response):
      stats.set_value('foo', 'bar')
  </code></pre>
  
  <p>Not sure what to <code>import</code> or how to make <code>stats</code> available in general. </p>