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


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

ANN: htmldammit 0.1

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Tal Einat <taleinat@gmail.com>
Newsgroups comp.lang.python.announce
Subject ANN: htmldammit 0.1
Date Sun, 7 Jan 2018 17:26:11 +0200
Lines 34
Approved python-announce-list@python.org
Message-ID <mailman.46.1515503434.2793.python-announce-list@python.org> (permalink)
References <CALWZvp6TBShVDW32EJwX-uWvVBKC5iz5_hTB1bjfy3i3j2JZSA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
X-Trace news.uni-berlin.de GamZnnZ55mkT7Z+FpDbShAmEKXJYCMWbkNmb/yAIu8/w==
Return-Path <taleinat@gmail.com>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:pypi': 0.03; 'binary': 0.05; 'closest': 0.07; 'exist,': 0.07; 'url-ip:192.30.253.112/32': 0.07; 'url-ip:192.30.253.113/32': 0.07; 'url-ip:192.30.253/24': 0.07; 'url:github': 0.07; '<>,': 0.09; 'charset': 0.09; 'declarations': 0.09; 'github': 0.09; 'subject:ANN': 0.09; 'library': 0.10; 'url-ip:192.30/16': 0.13; 'content-type': 0.16; 'decoding': 0.16; 'non-trivial': 0.16; 'subject:0.1': 0.16; 'urllib': 0.16; 'utility,': 0.16; 'embedded': 0.21; 'install': 0.22; 'requests': 0.23; 'hacking': 0.25; 'libraries': 0.25; 'url- ip:151.101.0.223/32': 0.26; 'url-ip:151.101.128.223/32': 0.26; 'url-ip:151.101.192.223/32': 0.26; 'url-ip:151.101.64.223/32': 0.26; 'url-ip:151.101.0/24': 0.26; 'url-ip:151.101.128/24': 0.26; 'url-ip:151.101.192/24': 0.26; 'url-ip:151.101.64/24': 0.26; 'header': 0.28; 'message-id:@mail.gmail.com': 0.29; 'announce': 0.31; 'quite': 0.31; 'extract': 0.31; "i'm": 0.33; 'received:google.com': 0.33; 'required.': 0.34; 'url- ip:151.101/16': 0.34; 'url-ip:151/8': 0.34; 'but': 0.36; 'objects': 0.37; 'url-ip:192/8': 0.37; 'consistently': 0.37; 'possible': 0.38; 'comments': 0.39; 'url:python': 0.39; 'url:org': 0.39; 'unicode': 0.40; 'gives': 0.40; 'care': 0.61; 'such': 0.61; 'information': 0.62; 'utilize': 0.62; 'manner': 0.66; 'direct': 0.71; 'furthermore,': 0.75; 'opener': 0.84; 'source:': 0.84; 'surprisingly': 0.84; 'welcome!': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=BSbJXDufEQBIBM7hdMCoUEhCDCERmg1HtBKks4Ob1gA=; b=OAlHlSKGsOV9E0HEfAmX8rdjbTt4WoF4DMI0g8S6b48NyUlDArNWy1B56deK5CWWgR eGkw5YUZhwwpV1d2bQVuLJgTWTa8f7DwrVuaGjBbLr5und3jhkNEt6UZhxpB062p5wEv wZL1bJWbWkgInqIfnhsSM/yGyaETqPGJLB2u9WGYhHfzJGGOrdREsQsnlu9lqyOaCwyt 57zPVux8L+riQk8Bull0s4WLDmbBKTj71RyeOiPkze9mCrJ1eqhZwDZJzQQfZn1WqH6h Yed+4i0Jh+cRgkNvfU4XSqg8KnHFDiSgY8uoRAsZLnBsY2stSAoOd3c6KELMs62nCY/+ Yz8A==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BSbJXDufEQBIBM7hdMCoUEhCDCERmg1HtBKks4Ob1gA=; b=GV7WJGmxlJt//IeRfy4to/SeJqTRDL+35vfOavtIVEodWrL3PC3RjBo93SQoAEAPtZ qeEnz6WshsFDXZLLZF9YlKQygxp7veIf7ueo9hv9nQsZEoLaJdrxtaIZoebYdYC2czA0 4rXruSnMmoCnhByvJPtAluNI0tnJu8PqQvVn5G9EAklP3xixXJRD/q8cZTl1H+affQnc 2sqniPhMwqUMrQTdGzB9OjrcO6P6J48HHOlxJ7PuTksE9caHtmPmznLoNE7yJ7cyztmk s8tH97k8woulHyaExeXE5FvWTZp/n11a7tIXvMHRFQz3dRJp3zrf1nbz+zm5Gg80t0pZ omwg==
X-Gm-Message-State AKwxytenvJgkYsZI+HCwAiYSnuaYRxRhcc/Yrpmzq14YbxseBNHkK7GE khYnBCWfxt/Z8CqOhL1/XPJtdvh7/YU4S9nV2dJH7g==
X-Google-Smtp-Source ACJfBotCyz2emC+ZHc9OUP+hOxqdlZc/wvAR9RE4k929oLJJV/Xrmf4x7mYfyIsWF9gkpGIZ3zM84xDzPbxPWlA0Rh4=
X-Received by 10.157.16.20 with SMTP id h20mr5491292ote.286.1515338791983; Sun, 07 Jan 2018 07:26:31 -0800 (PST)
X-Mailman-Approved-At Tue, 09 Jan 2018 08:10:33 -0500
X-Content-Filtered-By Mailman/MimeDel 2.1.25
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.25
Precedence list
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list/>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CALWZvp6TBShVDW32EJwX-uWvVBKC5iz5_hTB1bjfy3i3j2JZSA@mail.gmail.com>
Xref csiph.com comp.lang.python.announce:2732

Show key headers only | 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