Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Easier wrangling of web documents

Project description

Build Status Coverage Status

Soupy is a wrapper around BeautifulSoup that makes it easier to build complex queries when wrangling web data.

Here’s an example of a Soupy query.

from soupy import Soupy, Q

html = """
<div id="main">
  <div>The web is messy</div>
  and full of traps
  <div>but Soupy loves you</div>

      .each(Q.text.strip()) # extract text from each node, trim whitespace
      .filter(len)          # remove empty strings
      .val())               # dump out of Soupy

# ['The web is messy', 'and full of traps', 'but Soupy loves you']

The same query using BeautifulSoup:

 from bs4 import BeautifulSoup, NavigableString

html = """
<div id="main">
  <div>The web is messy</div>
  and full of traps
  <div>but Soupy loves you</div>

result = []
for node in BeautifulSoup(html).find(id='main').children:
    if isinstance(node, NavigableString):
        text = node.strip()
        text = node.text.strip()
    if len(text):


For more information, see the Soupy Documentation


pip install soupy


six and BeautifulSoup4

Soupy is supported on Python 2.6+ and 3.3+

Project details

Release history Release notifications

This version
History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
soupy-0.3.tar.gz (10.1 kB) Copy SHA256 hash SHA256 Source None Apr 13, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page