Skip to main content

Declarative web parsers

Project description

Soupstars :stew: :star: :boom:

Build Status Coverage Status Docs Version Image

Soupstars makes it fast and easy to build web parsers in Python.

It supports python 3.7+

Quickstart

Install it with pip.

pip install soupstars

Create a new parser using the soupstars command. The create command will use a template parser.

soupstars create -m myparser.py

Parsers are simple python modules.

cat myparser.py

Notice that the only set up required is the special parse decorator and a variable named url for the web page you want to parse.

from soupstars import parse

url = "https://corbettanalytics.com/"

@parse
def h1(soup):
    return soup.h1.text

You can test that the parser functions correctly.

soupstars test -m myparser.py

The output is a json object.

{
    "data": {
        "h1": "Level up your analytics"
    },
    "status": 200,
    "url": "https://corbettanalytics.com/",
    "errors": {}
}

More feature are available in the CLI. Type soupstars --help to see the list of commands

Usage: soupstars [OPTIONS] COMMAND [ARGS]...

  CLI to interact with SoupStars cloud.

Options:
  --help  Show this message and exit.

Commands:
  config    Print the configuration used by the client
  create    Create a new parser from a template
  health    Print the status of the SoupStars api
  login     Log in with an existing email
  ls        Show the parsers uploaded to SoupStars cloud
  pull      Pull a parser from SoupStars cloud into a local module
  push      Push a parser to SoupStars cloud
  register  Register a new account on SoupStars cloud
  run       Run a parser on SoupStars cloud
  show      Show the contents of a parser on SoupStars cloud
  test      Test running a parser locally
  version   Print the SoupStars version in use
  whoami    Print the email address of the current user

Deploying to soupstars.cloud

You can deploy your parsers to be ran on our service.

Use the CLI to create an account. You'll be prompted for a username and password.

soupstars register

Upload your parser.

soupstars push -m myparser.py

You can now run the parser from our service.

soupstars run -m myparser.py

Development

Install the package in development mode.

pip install -r requirements.txt
pip install --editable .

Run the tests.

pytest -v

Project details


Download files

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

Source Distribution

soupstars-2.0.8.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

soupstars-2.0.8-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file soupstars-2.0.8.tar.gz.

File metadata

  • Download URL: soupstars-2.0.8.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1

File hashes

Hashes for soupstars-2.0.8.tar.gz
Algorithm Hash digest
SHA256 48b1164e48e6d91781d86baf0b91d2ab1158740520e55fcfefb4bb898419ce11
MD5 e03f2c65f81d5a0d1f652d2e1b5be098
BLAKE2b-256 9b47b1e6ef50b90cd830f767877a8c71112bada78e3a1885562d5ce66f99f37f

See more details on using hashes here.

File details

Details for the file soupstars-2.0.8-py3-none-any.whl.

File metadata

  • Download URL: soupstars-2.0.8-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.1

File hashes

Hashes for soupstars-2.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 2b20df600e2f3e63beb0aaebfc7ef02e1ec65c67da08609f98b42978acdfe2e2
MD5 6e766958161eb0522a1e39db58ea03a2
BLAKE2b-256 b16ae941b7eb8b36ea2c756380097bf275beb9c84a9fd9b87c47925d1354eb54

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page