Scrapy, a fast high-level web crawling & scraping framework for Python.
xmlrpc: send request as POST by default and use dont_filter
Daniel Grana309bf9277e05
diff --git a/scrapy/trunk/scrapy/http/request/rpc.py b/scrapy/trunk/scrapy/http/request/rpc.pyindex 269426261..6e31159e8 100644--- a/scrapy/trunk/scrapy/http/request/rpc.py+++ b/scrapy/trunk/scrapy/http/request/rpc.py@@ -15,6 +15,13 @@ class XmlRpcRequest(Request):def __init__(self, *args, **kwargs):params = kwargs.pop('params')methodname = kwargs.pop('methodname')++ # spec defines that requests must use POST method+ kwargs.setdefault('method', 'POST')++ # xmlrpc query multiples times over the same url+ kwargs.setdefault('dont_filter', True)+Request.__init__(self, *args, **kwargs)self.body = xmlrpclib.dumps(params, methodname)self.headers.setdefault('Content-Type', 'text/xml')diff --git a/scrapy/trunk/scrapy/tests/test_http_request.py b/scrapy/trunk/scrapy/tests/test_http_request.pyindex b46645585..6a766c214 100644--- a/scrapy/trunk/scrapy/tests/test_http_request.py+++ b/scrapy/trunk/scrapy/tests/test_http_request.py@@ -189,6 +189,8 @@ class XmlRpcRequestTest(unittest.TestCase):r = XmlRpcRequest('http://scrapytest.org/rpc2', methodname='login', params=('username', 'password'))self.assertEqual(r.headers['Content-Type'], 'text/xml')self.assertEqual(r.body, "<?xml version='1.0'?>\n<methodCall>\n<methodName>login</methodName>\n<params>\n<param>\n<value><string>username</string></value>\n</param>\n<param>\n<value><string>password</string></value>\n</param>\n</params>\n</methodCall>\n")+ self.assertEqual(r.method, 'POST')+ self.assertTrue(r.dont_filter, True)if __name__ == "__main__":