mirror of https://github.com/scrapy/scrapy.git
Add backward compability when method=None in FormRequest
This commit is contained in:
parent
0c50879568
commit
2e4dc20393
|
|
@ -18,7 +18,7 @@ from scrapy.utils.response import get_base_url
|
|||
|
||||
|
||||
class FormRequest(Request):
|
||||
valid_form_methods = ['GET', 'POST', 'DIALOG']
|
||||
valid_form_methods = ['GET', 'POST']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
formdata = kwargs.pop('formdata', None)
|
||||
|
|
@ -50,9 +50,11 @@ class FormRequest(Request):
|
|||
formdata = _get_inputs(form, formdata, dont_click, clickdata, response)
|
||||
url = _get_form_url(form, kwargs.pop('url', None))
|
||||
|
||||
method = kwargs.pop('method', form.method).upper()
|
||||
if method not in cls.valid_form_methods:
|
||||
method = 'GET'
|
||||
method = kwargs.pop('method', form.method)
|
||||
if method is not None:
|
||||
method = method.upper()
|
||||
if method not in cls.valid_form_methods:
|
||||
method = 'GET'
|
||||
|
||||
return cls(url=url, method=method, formdata=formdata, **kwargs)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue