Skip to main content

strip-hidden-form-values

PyPI Changelog Tests License

CLI tool for stripping hidden form values from an HTML document

Why would you need this? Imagine you're running a Git scraper against a website that includes hidden form fields (such as those produced by __VIEWSTATE fields) that change on every request. You can pipe the HTML through this tool to strip those hidden form values such that a change is only recorded if the rest of the page is modified in some way.

scrape-ca-wildlife-rules is an example of a repository that uses this tool for that, see the scrape.yml workflow there for details.

Installation

Install this tool using pip:

$ pip install strip-hidden-form-values

Usage

You can pipe HTML into this tool:

curl http://... | strip-hidden-form-values > output.html

Or pass it a filename:

strip-hidden-form-values input.html > output.html

The tool will replace the value= attribute of any hidden form fields with a blank string, so the following:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="p8nVm4PgVPA" />

Will be replaced with:

<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="" />

All other HTML will remain unchanged.

Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:

cd strip-hidden-form-values
python -m venv venv
source venv/bin/activate

Or if you are using pipenv:

pipenv shell

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Release files for strip-hidden-form-values 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strip-hidden-form-values 0.2.1
File Size Uploaded
strip-hidden-form-values-0.2.1.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strip-hidden-form-values 0.2.1
File Interpreter ABI Platform
strip_hidden_form_values-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / strip-hidden-form-values-0.2.1.tar.gz

Download URL strip-hidden-form-values-0.2.1.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
61b2aa98602ccabc770b36ebcb8d8d03c8d30872daddce30efa06d31cc083d5f
BLAKE2b-256 checksum
How to use checksums
b9b84b5295fed5dc0719102a18146224c95b77272f663acbe91c3eafabb637b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / strip_hidden_form_values-0.2.1-py3-none-any.whl

Download URL strip_hidden_form_values-0.2.1-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cedce4300b2cb9998f4efba02a83e95582e2672ee72fd8c5cc6f992d31f0206
BLAKE2b-256 checksum
How to use checksums
9a8634d4ed575ab720eb31079e399f2546aea43b055121e83fd4c068de471341
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page