Skip to content

Commit

Permalink
1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris committed Apr 8, 2021
1 parent dc3e242 commit f617366
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
15 changes: 14 additions & 1 deletion docs/usage/BatchSpider.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def start_requests(self, task):
pass
```
任务拼接在`start_requests`里处理。这里的task参数为元组,值为BatchSpider启动参数中指定的`task_keys`对应的值
任务拼接在`start_requests`里处理。这里的task参数为BatchSpider启动参数中指定的`task_keys`对应的值

如表`batch_spider_task`,现有任务信息如下:
![-w398](http://markdown-media.oss-cn-beijing.aliyuncs.com/2021/02/22/16139773315622.jpg)
Expand Down Expand Up @@ -162,6 +162,19 @@ def crawl_test(args):
yield feapder.Request(url, task_id=id)
```
task值的获取方式,支持以下几种:

```python
# 列表方式
id, url = task
id = task[0]
url = task[1]
# 字典方式
id, url = task.id, task.url
id, url = task.get("id"), task.get("url")
id, url = task["id"], task["url"]
```


## 8. 更新任务状态

Expand Down
2 changes: 1 addition & 1 deletion feapder/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
1 change: 0 additions & 1 deletion feapder/utils/perfect_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

class PerfectDict(dict):
"""
>>> from feapder.utils.perfect_dict import PerfectDict
>>> data = PerfectDict(id=1, url="xxx")
>>> data
{'id': 1, 'url': 'xxx'}
Expand Down

0 comments on commit f617366

Please sign in to comment.