Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow passing over kwargs in .extract() #102

Open
Granitosaurus opened this issue Sep 30, 2017 · 0 comments
Open

Allow passing over kwargs in .extract() #102

Granitosaurus opened this issue Sep 30, 2017 · 0 comments

Comments

@Granitosaurus
Copy link

Granitosaurus commented Sep 30, 2017

Since extract() method is just a wrapper around lxml.etree.tostring it would make sense allowing of kwargs passthrough. This would enable more flexibility for getting string data.

For example it allows usage of pretty_print kwarg:

>>> foo = '<body><div>hi</div></body>'
>>> from parsel import Selector
>>> Selector(text=foo).extract()
'<html><body><div>hi</div></body></html>'
# vs
>>> print(Selector(text=foo).extract(pretty_print=True, method='xml'))
<html>
  <body>
    <div>hi</div>
  </body>
</html>

See my attempt at patch for this: #101

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants