Abstractions of web interactions
Project description
Web Traversal Library
The Web Traversal Library (WTL) is a Python library for abstracting web interactions on top of a base execution layer such as Selenium.
Installation
Run pip install webtraversallibrary
. That's it.
Usage example
Glossary
You will find more information in the API docs. As a high-level overview, common terms in the documentation are:
-
Workflow: The main orhcestrating class handling the main "event loop". Sometimes "schema" is also used for the specification of a certain workflow.
-
View: A static snapshot of a current website in a tab, with metadata associated to the page and its elements, possibly augmented with certain ML classifiers.
-
Policy: WTL is based on principles of reinforcement learning, where a policy is a function of the current state (here, the snapshots of current open tabs) to a set of actions.
-
Classifier: These, along with
preload_callbacks
andpostload_callbacks
are arbitray code that is executed on each workflow iteration. A classifier takes a set of elements and returns either a subset or a mapping from elements to numeric scores. -
Config: A helper class containing string, numeric, or boolean values for a number of configurations related to WTL. Some are pregrouped under certain umbrella names, such as
desktop
(running as a Desktop browser, the default is mobile emulation), but all values can be arbitrarily set. See the documentation for theConfig
class for more information.
Getting started
See the documentation at webtraversallibrary.readthedocs.io!
Also watch "Machine Learning to Auto-Navigate Websites" given at PyCon SE 2020 for an introduction and examples.
General architecture
The flow in a workflow is as follows:
- Initialize the workflow with given config
- Navigate to given URLs
- Snapshot the pages
- Run all classifiers
- Check if the goal is fulfilled, if so exit
- Call policy with the current view(s)
- Execute the returned action(s)
- Goto 3
For more examples and usage, please run make docs
and look at docs/build/html/index.html
.
Development setup
All development requirements are in requirements.txt. Install the packages from pip. Helper commands are available to create a virtual environment - make env-create
and make env-update
.
To lint the JavaScript files (not required unless you're editing them) you need jshint
which is available from npm.
How to contribute
See our guide on contributing.
Release History
See our changelog.
License
Copyright © 2020 Klarna Bank AB
For license details, see the LICENSE file in the root of this project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file webtraversallibrary-0.11.2.tar.gz
.
File metadata
- Download URL: webtraversallibrary-0.11.2.tar.gz
- Upload date:
- Size: 204.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9eccb5c6144d47043cda3d01a8e3d9bbb9ce14013da51c0f40d690d131306e8b |
|
MD5 | 7688cc5cf9219336f2091aa8b13900e0 |
|
BLAKE2b-256 | 3fa456d50c1a1246d93a884fce7946dd4cec16ceb44b7ba6befbfbce0bdfbc1b |
File details
Details for the file webtraversallibrary-0.11.2-py3-none-any.whl
.
File metadata
- Download URL: webtraversallibrary-0.11.2-py3-none-any.whl
- Upload date:
- Size: 237.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba97d1a399ac64dac5bac8acb5ad240e29fe35ace61b72eb8ec91a8bb1547f2 |
|
MD5 | c377c2650dc310d60c038b4a9ed408b8 |
|
BLAKE2b-256 | 98f408fb5044c38638c52ccaa57355bf17093372af72cc7420d6b8a0dbda0f77 |