From c7e4b8e1efd565d0af941ef66193cf57e430ba2d Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Wed, 15 May 2019 19:40:14 -0700 Subject: [PATCH] Add example itemsource --- sources/example.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 sources/example.py diff --git a/sources/example.py b/sources/example.py new file mode 100644 index 0000000..2fe6459 --- /dev/null +++ b/sources/example.py @@ -0,0 +1,26 @@ +""" +An example itemsource that produces an item with the current date. +Fetch new items with `python inquisitor update --sources examplesource`. +""" +# Standard library imports +from datetime import date +import time + +# Globals +SOURCE = "examplesource" + + +def fetch_new(state): + now = date.today() + item = { + 'id': '{}-{}-{}'.format(now.year, now.month, now.day), + 'source': SOURCE, + 'active': True, + 'time': time.time(), + 'created': time.time(), + 'title': "Today is {}-{}-{}".format(now.year, now.month, now.day), + #'link': + #'author': + #'body': + } + return [item]