Skip to content

Commit

Permalink
fix some bug for python2
Browse files Browse the repository at this point in the history
  • Loading branch information
binux committed Dec 14, 2014
1 parent c19dfcb commit 81b0493
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion pyspider/libs/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def on_result(self, task, result):
class Handler(BaseHandler):
def on_start(self):
self.crawl('http://localhost:5000/bench', params={'total': %(total)d, 'show': %(show)d}, callback=self.index_page)
self.crawl('http://127.0.0.1:5000/bench',
params={'total': %(total)d, 'show': %(show)d},
callback=self.index_page)
def index_page(self, response):
for each in response.doc('a[href^="http://"]').items():
Expand Down
2 changes: 1 addition & 1 deletion pyspider/processor/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def on_task(self, task, response):
'ok': not ret.exception,
'time': process_time,
'follows': len(ret.follows),
'result': utils.unicode_obj(ret.result)[:self.RESULT_RESULT_LIMIT],
'result': utils.text(ret.result)[:self.RESULT_RESULT_LIMIT],
'logs': ret.logstr()[-self.RESULT_LOGS_LIMIT:],
'exception': ret.exception,
},
Expand Down
11 changes: 6 additions & 5 deletions pyspider/webui/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

from __future__ import unicode_literals

from app import app
from flask import render_template, request, json
from flask import Response
from six import iteritems

import six
import csv
import itertools
from io import BytesIO

from six import iteritems
from app import app
from flask import render_template, request, json
from flask import Response
from pyspider.libs.utils import utf8


Expand Down

0 comments on commit 81b0493

Please sign in to comment.