Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #2732

ANN: htmldammit 0.1

From Tal Einat <taleinat@gmail.com>
Newsgroups comp.lang.python.announce
Subject ANN: htmldammit 0.1
Date 2018-01-07 17:26 +0200
Message-ID <mailman.46.1515503434.2793.python-announce-list@python.org> (permalink)
References <CALWZvp6TBShVDW32EJwX-uWvVBKC5iz5_hTB1bjfy3i3j2JZSA@mail.gmail.com>

Show all headers | View raw


I'm happy to announce htmldammit <https://pypi.python.org/pypi/htmldammit>,
a library for decoding binary HTML data into Unicode in the best possible
way.

Suggestions and comments are most welcome!


Installation: `pip install htmldammit`

Source: GitHub <https://github.com/taleinat/htmldammit>

Rationale:

When it comes to decoding HTML,Common libraries such as requests and
BeautifulSoup do not make the best possible use of information from both
the raw data as well as the HTTP Content-Type header. Combining them to get
the best possible result is surprisingly far from straightforward.

BeauftulSoup comes closest with it UnicodeDammit utility, but gives no
direct support for taking advantage of Content-Type header information.
Furthermore, in order to utilize the Content-Type header while preferring
embedded charset declarations in a document when those exist, quite some
hacking is required.

htmldammit takes care of all of this. It uses UnicodeDammit in a
non-trivial manner under the hood. It supplies simple functions to extract
all of the needed data from a urlopen() and requests.get() response objects
and return Unicode HTML.

Additionally, a request hook for requests and an opener for urllib are
supplied to make using this consistently simpler.

Regards,
- Tal Einat

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

ANN: htmldammit 0.1 Tal Einat <taleinat@gmail.com> - 2018-01-07 17:26 +0200

csiph-web