python-premailer converts HTML with style tags into HTML with inline style attributes; gmail won’t render nice without it!
I made it so I could send colorized git diffs of func-inventory around…
Use:
$ sudo pip install python-premailer
$ python
>>> from pypremailer import Premailer
>>> head = '<html><head><style>foo {size:10px;}</style></head>'
>>> body = '<body><span class="foo">bar</span></html>'
>>> html = '%s%s' % ( head, body )
>>> p = Premailer(html)
>>> p.premail()
<html><head></head><body><span style="size: 10px">bar</span></body></html>
Get the source:
On PyPI:
Excuses, excuses
This definitely already exists in pypi under the name ‘premailer’, but I wanted to reimplement it without the use of lxml.
Check it out! http://pypi.python.org/pypi/premailer
Another package called pyinliner might do the job for you as well: http://pypi.python.org/pypi/pynliner
Inspired by
Emogrifier (php): http://www.pelagodesign.com/sidecar/emogrifier/
Premailer (ruby): http://premailer.dialect.ca/
Metadata
Release files for python-premailer 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-premailer-0.5.7.tar.gz | 2.6 kB | Without provenance | Details |
Release files / python-premailer-0.5.7.tar.gz
| Download URL | python-premailer-0.5.7.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44aac17b2ca2accf147bdca2496d896aed2dcf2248fe802513374780e92f8994
|
|
BLAKE2b-256 checksum How to use checksums |
f70454d5c5a4e4faf373c1e5ba2975a7a90ef9becfbaea20af839833caad42fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for python-premailer 0.5.7
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.