简体   繁体   中英

Custom JSON Response from Scrapy Spider Deployed via Scrapyd

I need to find a way to make my Scrapy spider return a custom JSON response. It is deployed via scrapyd using schedule.json . Schedule.json responds with JobID and Status , but I'd like to add some more data to that response.

If there's a way I could do it by creating a separate response and then make a separate request that would work as well.

Much appreciated!

在此处输入图片说明

(taken from Learn to Read the Source, Luke ).

It is doable.

Implement your own resource based on scrapyd.webservice.WsResource , write a render_POST() method. Then, tell scrapyd to use your schedule.json resource implementation:

[services]
schedule.json = project.module.MySchedule

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM