Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spider 添加类型注释 #147

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ruia/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def _run_spider_hook(self, hook_func):
except Exception as e:
raise SpiderHookError(f"<Hook {hook_func.__name__}: {e}")

async def process_failed_response(self, request, response):
async def process_failed_response(self, request: Request, response: Response):
"""
Corresponding processing for the failed response
:param request: Request
Expand All @@ -68,7 +68,7 @@ async def process_failed_response(self, request, response):
"""
pass

async def process_succeed_response(self, request, response):
async def process_succeed_response(self, request: Request, response: Response):
"""
Corresponding processing for the succeed response
:param request: Request
Expand All @@ -77,7 +77,7 @@ async def process_succeed_response(self, request, response):
"""
pass

async def process_item(self, item):
async def process_item(self, item: Item):
"""
Corresponding processing for the Item type
:param item: Item
Expand Down Expand Up @@ -424,7 +424,7 @@ async def multiple_request(self, urls, is_gather=False, **kwargs):
response.index = index
yield response

async def parse(self, response):
async def parse(self, response: Response):
"""
Used for subclasses, directly parse the responses corresponding with start_urls
:param response: Response
Expand Down