Untable
A lightweight Python module to scrape HTML tables.
>>> import untable
>>> import requests
>>> from pprint import pprint
>>> html = requests.get("https://www.w3schools.com/html/html_tables.asp").text
>>> data = untable.multi(html)
>>> pprint(data)
[{'Company': 'Alfreds Futterkiste',
'Contact': 'Maria Anders',
'Country': 'Germany'},
{'Company': 'Centro comercial Moctezuma',
'Contact': 'Francisco Chang',
'Country': 'Mexico'},
{'Company': 'Ernst Handel', 'Contact': 'Roland Mendel', 'Country': 'Austria'},
{'Company': 'Island Trading', 'Contact': 'Helen Bennett', 'Country': 'UK'},
{'Company': 'Laughing Bacchus Winecellars',
'Contact': 'Yoshi Tannamuri',
'Country': 'Canada'},
{'Company': 'Magazzini Alimentari Riuniti',
'Contact': 'Giovanni Rovelli',
'Country': 'Italy'}]
Installation
pip install untable
Usage
Untable can extract data from two types of tables: single and multi-entity.
Multi-entity tables are like the one in the example above, where a table carries information for multiple items. They have headers on their first row and data on the others. Use untable.multi on them.
Single entity tables carry data from only one entity, in a form-like structure. They can have headers and data on the same row. For example:
| Name: | Ada Lovelace |
| DOB: | 12-10-1815 |
| Profession: | Programmer |
Use untable.single on this type of table. You may need to play with the threshold parameter to get the extraction right.
Read untable.py to find more information.
Contribute
PRs welcome!
Metadata
Release files for untable 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| untable-0.1-py3-none-any.whl | Python 3 | none | any | Details for untable-0.1-py3-none-any.whl |
Release files / untable-0.1-py3-none-any.whl
| Download URL | untable-0.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7824015f3a9a6371c18ab120e4636dc5758452b86ca855f5d217d277454418d7
|
|
BLAKE2b-256 checksum How to use checksums |
0f11284b3534a368cdd086d25e7bd23da0413e79b758601b4ed4fe87e381d3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|
Security for untable 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.