Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit 3fb9167

Browse files
vibiubinux
authored andcommitted
change async to async_ (#803)
* change async to async_ * change async to async_ in tests * change async_ to async_mode
1 parent 7037a77 commit 3fb9167

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

pyspider/fetcher/tornado_fetcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ class Fetcher(object):
7878
splash_lua_source = open(os.path.join(os.path.dirname(__file__), "splash_fetcher.lua")).read()
7979
robot_txt_age = 60*60 # 1h
8080

81-
def __init__(self, inqueue, outqueue, poolsize=100, proxy=None, async=True):
81+
def __init__(self, inqueue, outqueue, poolsize=100, proxy=None, async_mode=True):
8282
self.inqueue = inqueue
8383
self.outqueue = outqueue
8484

8585
self.poolsize = poolsize
8686
self._running = False
8787
self._quit = False
8888
self.proxy = proxy
89-
self.async = async
89+
self.async = async_mode
9090
self.ioloop = tornado.ioloop.IOLoop()
9191

9292
self.robots_txt_cache = {}

pyspider/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def scheduler(ctx, xmlrpc, xmlrpc_host, xmlrpc_port,
228228
@click.pass_context
229229
def fetcher(ctx, xmlrpc, xmlrpc_host, xmlrpc_port, poolsize, proxy, user_agent,
230230
timeout, phantomjs_endpoint, splash_endpoint, fetcher_cls,
231-
async=True, get_object=False, no_input=False):
231+
async_mode=True, get_object=False, no_input=False):
232232
"""
233233
Run Fetcher.
234234
"""
@@ -242,7 +242,7 @@ def fetcher(ctx, xmlrpc, xmlrpc_host, xmlrpc_port, poolsize, proxy, user_agent,
242242
inqueue = g.scheduler2fetcher
243243
outqueue = g.fetcher2processor
244244
fetcher = Fetcher(inqueue=inqueue, outqueue=outqueue,
245-
poolsize=poolsize, proxy=proxy, async=async)
245+
poolsize=poolsize, proxy=proxy, async_mode=async_mode)
246246
fetcher.phantomjs_proxy = phantomjs_endpoint or g.phantomjs_proxy
247247
fetcher.splash_endpoint = splash_endpoint
248248
if user_agent:
@@ -362,7 +362,7 @@ def webui(ctx, host, port, cdn, scheduler_rpc, fetcher_rpc, max_rate, max_burst,
362362
else:
363363
# get fetcher instance for webui
364364
fetcher_config = g.config.get('fetcher', {})
365-
webui_fetcher = ctx.invoke(fetcher, async=False, get_object=True, no_input=True, **fetcher_config)
365+
webui_fetcher = ctx.invoke(fetcher, async_mode=False, get_object=True, no_input=True, **fetcher_config)
366366

367367
app.config['fetch'] = lambda x: webui_fetcher.fetch(x)
368368

tests/test_fetcher_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestFetcherProcessor(unittest.TestCase):
2323
@classmethod
2424
def setUpClass(self):
2525
self.projectdb = ProjectDB([os.path.join(os.path.dirname(__file__), 'data_fetcher_processor_handler.py')])
26-
self.fetcher = Fetcher(None, None, async=False)
26+
self.fetcher = Fetcher(None, None, async_mode=False)
2727
self.status_queue = Queue()
2828
self.newtask_queue = Queue()
2929
self.result_queue = Queue()

tests/test_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class TestResponse(unittest.TestCase):
2929

3030
@classmethod
3131
def setUpClass(self):
32-
self.fetcher = Fetcher(None, None, async=False)
32+
self.fetcher = Fetcher(None, None, async_mode=False)
3333
self.httpbin_thread = utils.run_in_subprocess(httpbin.app.run, port=14887, passthrough_errors=False)
3434
self.httpbin = 'http://127.0.0.1:14887'
3535
time.sleep(0.5)

0 commit comments

Comments
 (0)