Created
May 22, 2015 16:06
-
-
Save eventuallyc0nsistent/92a825a0fae102f3c0d5 to your computer and use it in GitHub Desktop.
Querying a Scrapy spider with JSON RPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'http://localhost:6080/crawler' | |
# This will call the crawler objects stop method. | |
# Checkout all the methods the crawler object has: | |
# https://github.com/scrapy/scrapy/blob/master/scrapy/crawler.py#L24 | |
data = '{"id" : 2, "method" : "stop"}' | |
# The project has been moved out of scrapy but heres the web service API | |
# https://github.com/scrapy/scrapy-jsonrpc/blob/master/scrapy_jsonrpc/webservice.py | |
requests.post(url, data=data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment