框架 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 :( 谢谢!