eml2png

This is the documentation of eml2png.

Contents

License

MIT License

Copyright (c) 2019 poipoii

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors

Changelog

Version 0.0.2, 2019-06-21

  • Add simple docker server.
  • Add eml_str arg into get_html_str_from_file.
  • Add imgkit args into to_png.

Version 0.0.1, 2019-06-19

  • Initial

eml2png

eml2png package

Submodules
eml2png.eml2png module
eml2png.eml2png.get_html_str_from_file(file_path, eml_str=None)[source]

Get HTML part from EML file.

Parameters:file_path ([str]) – Input EML file
Keyword Arguments:
 eml_str ([str]) – EML string (default: None)
Returns:EML HTML string
Return type:[str]
eml2png.eml2png.to_png(file_path, html_str=None, config=None, options=None)[source]

Paint the EML to a single PNG image.

Parameters:

file_path ([str]) – EML file path

Keyword Arguments:
 
  • html_str ([str]) – EML HTML string (default: None)
  • config – imgkit config (default: None)
  • options – imgkit options (default: None)
Returns:

a PNG byte string.

Return type:

[bytes]

eml2png.skeleton module

This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the [options.entry_points] section in setup.cfg:

console_scripts =
eml2png = eml2png.skeleton:run

Then run python setup.py install which will install the command eml2png inside your current environment. Besides console scripts, the header (i.e. until _logger…) of this file can also be used as template for Python modules.

eml2png.skeleton.eml_to_png(input, output=None)[source]

eml_to_png function

Parameters:
  • input (str) – input EML file
  • output (str) – output PNG file (Default: None)
Returns:

output PNG file path. Return input + ‘.png’ if output is None.

Return type:

str

eml2png.skeleton.main(args)[source]

Main entry point allowing external calls

Parameters:args ([str]) – command line parameter list
eml2png.skeleton.parse_args(args)[source]

Parse command line parameters

Parameters:args ([str]) – command line parameters as list of strings
Returns:command line parameters namespace
Return type:argparse.Namespace
eml2png.skeleton.run()[source]

Entry point for console_scripts

eml2png.skeleton.setup_logging(loglevel)[source]

Setup basic logging

Parameters:loglevel (int) – minimum loglevel for emitting messages
Module contents

Indices and tables