FeedMe provides an easy way to parse XML Feeds, render them in an HTML file, and send them based on a template to your email contacts. It supports tracking to send only fresh data in each run.
Installing the application is very simple, just follow the directions below:
- Install Python https://www.python.org/downloads/ and add it to your path
- Install Git https://git-scm.com/downloads and add it yo your path
- Check if you have pip (python package manager) installed by running pip --version
- If not, download the file [get-pip.py] (https://bootstrap.pypa.io/get-pip.py/), being careful to save it as a .py file rather than .txt
- Run it from the command prompt: python get-pip.py
- Run the command pip install git+https://github.com/alimasri/feedme
After installation, you can access the program from a command line interface using the following command:
$ feedme [-h] -u URL -c CONFIG [-s {google,smtp,none}] [-l LOGFILE] [-i]
[--version] [-v] [-vv]
Arguments:
-h, --help show this help message and exit
-u URL, --url URL feed URL
-c CONFIG, --config CONFIG
YAML configuration file
-s {google,smtp,none}, --email-service {google,smtp,none}
email service name (none if quiet mode)
-l LOGFILE, --log LOGFILE
log file path
-i, --ignore-tracker force feed processing even if fees was already
processed
--version show program's version number and exit
-v, --verbose set loglevel to INFO
-vv, --very-verbose set loglevel to DEBUG
FeedMe uses YAML to load the required configurations.
Create a YAML file using the following template and pass it to the (-c or --config) parameter.
templates_folder: path to the templates folder (may contain multiple templates)
template_name: name of the template to be parsed (must be inside the templates folder)
output_folder: path to save the generated files
sender: sender's email
contacts: path to a file containing your list of recipients emails (one email per line)
credentials:
host: smtp URL
port: smtp port
login: smtp login
password: smtp password
file: in case of choosing google service, this is the path to your credentials.json file [more info](https://developers.google.com/gmail/api/quickstart/python)
Feed me uses (Jinja)[https://jinja.palletsprojects.com/en/2.11.x/] for rendering templates.
To design an email template:
- create an HTML file
- use HTML language to design the static blocks of the website
- use Jinja to load dynamic content from the feed
FeedMe passes two variables to your file
- date: current datetime
- feed: feed information such as title, subtitle, updated, etc.
- posts: the feed entries
An Example of a template file
<h1>{{ feed.title }}</h1>
<h2>{{ feed.subtitle }}</h2>
<h3>Updated At: {{ feed.updated}}</h3>
<h2>Current Time: {{ date }}</h2>
<div>
{% for post in posts %}
<div>
<h4><a href="{{post.link}}">{{ post.title }}</a></h1>
<h5>{{ post.author }}</h5>
{{ post.summary }} <a href="{{post.link}}">Read more</a>
</div>
{% endfor %}
</div>