Skip to main content

No project description provided

Project description

Web Valueist Logo

Web Valueist

PyPI version Python versions License GitHub Issues CI Docs

Documentation Website

Fetches a value from the web, compares it with a given value and exits with zero exit code if the condition is satisfied

Setup

While in project directory:

./install.sh

Installation

You can install web-valueist from PyPI using your preferred package manager:

pip:

pip install web-valueist

Poetry:

poetry add web-valueist

uv:

uv pip install web-valueist

pipenv:

pipenv install web-valueist

Usage:

web_valueist [-h] [--debug] [--json] url parser_name [quantifier] selector operator_name value

positional arguments:
  url
  parser_name
  quantifier      Optional: ANY or EVERY (default: ANY)
  selector
  operator_name
  value

options:
  -h, --help      show this help message and exit
  --debug         Show debug logs including found values
  --json          Output input and result as JSON

Sample Usage

By default, web_valueist is silent and communicates success or failure via the exit code.

Sample success

python -m web_valueist https://www.ikea.com.cy/en/products/fjallhavre-duvet-warm-240x220-cm/70458057/ int span.price__integer ">" 240

( you can also use gt instead of ">")

Exit Code: 0

Sample failure

python -m web_valueist https://www.ikea.com.cy/en/products/fjallhavre-duvet-warm-240x220-cm/70458057/ int span.price__integer "<" 240

( you can also use lt instead of "<")

Exit Code: 1

Debugging

Use the --debug flag to see the values fetched from the web.

python -m web_valueist https://www.ikea.com.cy/en/products/fjallhavre-duvet-warm-240x220-cm/70458057/ int span.price__integer ">" 240 --debug

Output:

DEBUG:web_valueist.lib:Found value ['245']

JSON Output

Use the --json flag to get a structured output.

python -m web_valueist http://example.com str h1 "eq" "Example Domain" --json

Output:

{"args": {"url": "http://example.com", "parser_name": "str", "quantifier": "ANY", "selector": "h1", "operator_name": "eq", "value": "Example Domain"}, "result": {"success": true, "value": "Example Domain"}}

Using Quantifiers

When a selector matches multiple elements, you can use ANY or EVERY.

  • ANY (default): At least one selector match needs to satisfy the condition.
  • EVERY: All selector matches need to satisfy the condition.

Example using EVERY:

python -m web_valueist https://example.com int EVERY .price ">" 100

If no quantifier is specified, ANY is used by default.

Sample cron job

*/30 * * * * web_valueist "https://www.bazaraki.com/car-motorbikes-boats-and-parts/cars-trucks-and-vans/mazda/mazda-mx5/year_min---71/?ordering=cheapest&lat=35.01804869361969&lng=34.04709596563199&radius=5000&price_max=30000" int .advert__content-price._not-title   "<" 22500 &&message="Some fancy car matching your criteria was found" &&if command -v notify-send >/dev/null 2>&1 ; then notify-send "$message"; else say "$message"; fi

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

web_valueist-1.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

web_valueist-1.0.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file web_valueist-1.0.0.tar.gz.

File metadata

  • Download URL: web_valueist-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for web_valueist-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b64aa7ab757c7495e9a63441e0a2ef4f641679be058d3228fa3ceaac881e84e8
MD5 89464f1171e565523c8cfd9c9e994222
BLAKE2b-256 356fb572a1490f65cbb856da6f8c25e0f3c4d4add68d0a3adb9786a33d4eda1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for web_valueist-1.0.0.tar.gz:

Publisher: pypi-publish.yml on agalazis/web-valueist

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file web_valueist-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: web_valueist-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for web_valueist-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4dfb58e9267e4066e94b7da2c030eb4e18f9fbb54c87fe271d23d05d365c8f1a
MD5 9738e7df7b1331e833b4dd5a4a4f00af
BLAKE2b-256 c2d94cd464aeb386e2aa6f13443317f1b03ababad828f2c1e78324b81db0536e

See more details on using hashes here.

Provenance

The following attestation bundles were made for web_valueist-1.0.0-py3-none-any.whl:

Publisher: pypi-publish.yml on agalazis/web-valueist

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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