New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid URL Encoding as an option #3542
base: master
Are you sure you want to change the base?
Conversation
I can't get this correct unless scrapy/w3lib#119 is merged because this commit uses the modified method of safe_url_string of w3lib. |
scrapy/http/request/__init__.py
Outdated
@@ -16,12 +16,13 @@ | |||
|
|||
class Request(object_ref): | |||
|
|||
def __init__(self, url, callback=None, method='GET', headers=None, body=None, | |||
def __init__(self, url, quote_path=True, callback=None, method='GET', headers=None, body=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the second positional argument is callback
, putting quote_path
in its place would be backwards incompatible. I'd sugest you to move it to the end of the arguments list, I suspect that's why the tests are failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elacuesta , I did it tests are failing because , my PR scrapy/w3lib#119 didn't merge yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maramsumanth it has been merged:
@Gallaecio not really sure about the current CI failing but this seems pretty straightforward. Are the changes on this PR currently worth to be merged or has anything significant changed in master that would make this deprecated somehow? If not, I am willing to do the sync and also add some unit tests if it is worth it. |
From another angle, the integration is seamless as far as it looks, so the unit tests at scrapy/w3lib#119 should suffice. Nevertheless, it may be worth adding a small doc update over the added argument on Request init? |
Fixes #833.
Case (i):-
In the above case I am able to add quote_path as an argument in the Request constructor. This is set to
True (default)
if the user wants to quote the URL.Case (ii):-
I want to add an option to the command
scrapy shell "http://google.com/\"hello\""
which when set to True, we get <GET http://google.com/%22hello%22> , if it is set to False, we get<GET http://google.com/"hello">I dont have idea how to add option for that (Case-(ii)) command. Any suggestions?
Mentors please guide me @kmike @cathalgarvey @lopuhin :)
(PS:- I used \ for each " of hello as escape sequence in order to include it in the URL)
At present I had opened a PR for Case (i), ideas for Case (ii) are welcome :)
I opened a PR for w3lib to modify safe_url_string method. Please look into this scrapy/w3lib#119
Thanks :)