Skip to main content

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.

Build Status License Developed at Klarna Documentation Status

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 and postload_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 the Config 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:

  1. Initialize the workflow with given config
  2. Navigate to given URLs
  3. Snapshot the pages
  4. Run all classifiers
  5. Check if the goal is fulfilled, if so exit
  6. Call policy with the current view(s)
  7. Execute the returned action(s)
  8. 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.

Release files for webtraversallibrary 0.13.2

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

Source distribution (sdist)

Source distribution for webtraversallibrary 0.13.2
File Size Uploaded
webtraversallibrary-0.13.2.tar.gz 210.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for webtraversallibrary 0.13.2
File Interpreter ABI Platform
webtraversallibrary-0.13.2-py3-none-any.whl Python 3 none any Details

Total release size: 451.5 kB

Release files / webtraversallibrary-0.13.2.tar.gz

Download URL webtraversallibrary-0.13.2.tar.gz
Size 210.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2d44f3148739da6eca3453ca953c0b40fedc99acd634d875cda607cb76565f54
BLAKE2b-256 checksum
How to use checksums
2b820ad7324024e9711db2d6ebf78f9460017e0333a11b5066c37a3ecf8ccce7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / webtraversallibrary-0.13.2-py3-none-any.whl

Download URL webtraversallibrary-0.13.2-py3-none-any.whl
Size 241.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36c5c780a2d0b908a70a10f11ddd591221637a23e45fa0df3188be5235b85f7f
BLAKE2b-256 checksum
How to use checksums
89ae8ec2882459a9012dd773da51b9f5b826dcb7ef732400744a42f6ee6679ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.13.2 This release

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.3

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.3

2 release files

0.9.2

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