IPython-BeautifulSoup
IPython-BeautifulSoup is an IPython extension for displaying BeautifulSoup HTML/XML objects as prettified and syntax highlighted HTML blocks in IPython notebook and qtconsole.
Syntax highlighting is accomplished with Pygments.
Install
Simply run:
pip install "ipython-beautifulsoup[bs4]"
Installing IPython Notebook
See the IPython installation docs for details.
To install IPython notebook or qtconsole as well, append notebook and/or qtconsole to the extras specifier after “bs4” separated by a “,”, like this:
pip install "ipython-beautifulsoup[bs4,notebook,qtconsole]"
On Ubuntu LTS, if you want to install IPython notebook, you’ll need to do this before:
sudo apt-get install python-dev g++
(use python3-dev if you’re using Python 3)
For the qtconsole do this (if you do this in a virtualenv) (WARNING: it’s slow):
sudo apt-get install make cmake qt4-qmake libqt4-dev pip install pyside
Usage
In IPython notebook or qtconsole, run:
%load_ext soup
This will push a series of callables into your current context, as well as a monkey-patched BeautifulSoup and requests.
You can now use BeautifulSoup like you would if it was imported from the corresponding module.
There is great chances that you’ll want to configure the output by using configure_ipython_beautifulsoup, for example like this (just after the %load_ext):
configure_ipython_beautifulsoup(show_html=True, show_css=True, show_js=False)
To see configure_ipython_beautifulsoup documentation just do (in any interface of IPython):
configure_ipython_beautifulsoup?
This also loads a shortcut function called p (for Parse) defined as follows:
def p(url):
if requests is not None:
return BeautifulSoup(requests.get(url).contents)
return BeautifulSoup(urlopen(url).read())
A note on security
WARNING
By nature of including external HTML, JS, and CSS, this extension is inherently unsafe if you choose to render the html by setting show_html to True when calling ``configure_ipython_beautifulsoup``.
By default, <script>, <link>, and <style> tags are removed but this isn’t a 100% guarantee that this is secure if you choose to render the html, use at your own risk.
The safest option is to set all options of configure_ipython_beautifulsoup to False (the default).
Screenshots
IPython Notebook
.find:
.find_all:
Contributors
In chronological order:
Don’t hesitate to add yourself.
Changelog
0.3 (2014-08-26)
python 3 compatibility
classifiers in the setup.py
and a series of small fixes
also: wheel!
mainly the work of Matt Morrison, see https://github.com/Psycojoker/ipython-beautifulsoup/pull/5
0.2 (2014-01-06)
security improvement (configure_ipython_beautifulsoup)
tests!
mostly the work of westurner, see https://github.com/Psycojoker/ipython-beautifulsoup/pull/3
0.1.1 (2014-01-04)
bug fixes
0.1 (2014-01-04)
Init
Metadata
Release files for ipython-beautifulsoup 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ipython-beautifulsoup-0.3.tar.gz | 4.9 kB | Without provenance | Details for ipython-beautifulsoup-0.3.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipython_beautifulsoup-0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for ipython_beautifulsoup-0.3-py2.py3-none-any.whl |
| ipython_beautifulsoup-0.3-py2.7.egg | Legacy Egg format | - | - | Details for ipython_beautifulsoup-0.3-py2.7.egg |
Total release size: 16.9 kB
Release files / ipython-beautifulsoup-0.3.tar.gz
| Download URL | ipython-beautifulsoup-0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14c9999fcaffab06d35a818770e56e8ae35726132af6c76e43f811dc2f25ff44
|
|
BLAKE2b-256 checksum How to use checksums |
6c7719aac42588e2140baaf29d7f79b5c4696de13a8d212ae5740dc9cb7a4dd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ipython_beautifulsoup-0.3-py2.py3-none-any.whl
| Download URL | ipython_beautifulsoup-0.3-py2.py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2c74ee6592bf697235819f7f6f3336ac0858d5784890ffd3218bb917d06e4711
|
|
BLAKE2b-256 checksum How to use checksums |
e83f6bc064a5bde8256ef78f747f142be72f44252fbe6135ab9d2d11e1c7cb8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ipython_beautifulsoup-0.3-py2.7.egg
| Download URL | ipython_beautifulsoup-0.3-py2.7.egg |
|---|---|
| Size | 4.6 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
853a165a4f06135e510034adcfdd45c86a1e753954ddbf94acdaf618ef63d834
|
|
BLAKE2b-256 checksum How to use checksums |
997ff140dce5ea6de6084e3caf5e9ee9b8ca5b8c1251dd413268089ea4edef3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ipython-beautifulsoup 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.