This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.web.iweb import IBodyProducer | |
from twisted.internet import defer | |
from twisted.web.client import Agent | |
from twisted.web.http_headers import Headers | |
from zope.interface import implements | |
import urllib | |
class StringProducer(object): | |
implements(IBodyProducer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filter { | |
grok { | |
match => [ "message", "%{TIMESTAMP_ISO8601:ts} \[%{USERNAME:spider}\] %{LOGLEVEL:level}: Crawled %{NUMBER:pages2:int} pages \(at %{NUMBER:pages_rate2:int%} pages/min\), scraped %{NUMBER:items2:int} items \(at %{NUMBER:items_rate2:int%} items/min\)" ] | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import csv, json, sys, cStringIO, codecs | |
from operator import itemgetter | |
def fmt(s): | |
if s == None: | |
return '' | |
elif isinstance(s, basestring): | |
return s.encode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing, time | |
from multiprocessing import Pool, JoinableQueue, Process | |
SENTINEL = -1 | |
def worker(q,rq, callback): | |
for item in iter(q.get, SENTINEL): | |
callback(rq, item) | |
q.task_done() | |
q.task_done() |
NewerOlder