【发布时间】:2012-03-11 04:28:07
【问题描述】:
框架 Scrapy - Scrapyd 服务器。
我在蜘蛛内部获取 jobid 值时遇到了一些问题。
将数据发布到http://localhost:6800/schedule.json 后,回复是
status = ok
jobid = bc2096406b3011e1a2d0005056c00008
但是我需要在这个过程中在当前蜘蛛中使用这个jobid。它可以用于打开 {jobid}.log 文件或其他动态原因。
class SomeSpider(BaseSpider):
name = "some"
start_urls = ["http://www.example.com/"]
def parse(self, response):
items = []
for val in values:
item = SomeItem()
item['jobid'] = self.jobid # ???!
items.append(item)
return items
但是我只有在任务完成后才能看到这个jobid :( 谢谢!
【问题讨论】: