polyglot.kindle (class) ∞
-
class
polyglot.
kindle
(log, settings, urlOrPath, title=False, header=False, footer=False)[source] ∞ Send documents or webpage articles to a kindle device or app
- Key Arguments:
log
– loggersettings
– the settings dictionaryurlOrPath
– the url or path to the content sourcetitle
– the title of the output document. I. False then use the title of the original source. Default Falseheader
– content to add before the article/book content in the resulting ebook. Default Falsefooter
– content to add at the end of the article/book content in the resulting ebook. Default False
Usage:
To send content from a webpage article straight to your kindle device or smart phone app, you will first need to populate the email settings with polyglot’s settings file at
~.config/polyglot/polyglot.yaml
, then use the following code:from polyglot import kindle sender = kindle( log=log, settings=settings, urlOrPath="http://www.thespacedoctor.co.uk/blog/2016/09/26/mysqlSucker-index.html", header='<a href="http://www.thespacedoctor.co.uk">thespacedoctor</a>', footer='<a href="http://www.thespacedoctor.co.uk">thespacedoctor</a>' ) success = sender.send()
Success is True or False depending on the success/failure of sending the email to the kindle email address(es).
Methods
__init__
(log, settings, urlOrPath[, title, ...])get
()get the ebook object get_attachment
(file_path)Get file as MIMEBase message send
()send the mobi book generated to kindle email address(es)