2019-05-16 02:40:14 +00:00
|
|
|
"""
|
|
|
|
An example itemsource that produces an item with the current date.
|
2019-06-14 19:50:59 +00:00
|
|
|
ANy args provided will be added to the item body.
|
|
|
|
Fetch new items with `python inquisitor update --sources example`
|
|
|
|
or `--sources example:argument`.
|
2019-05-16 02:40:14 +00:00
|
|
|
"""
|
|
|
|
# Standard library imports
|
|
|
|
from datetime import date
|
|
|
|
import time
|
|
|
|
|
|
|
|
# Globals
|
|
|
|
SOURCE = "examplesource"
|
|
|
|
|
|
|
|
|
2019-06-14 19:50:59 +00:00
|
|
|
def fetch_new(state, args):
|
2019-05-16 02:40:14 +00:00
|
|
|
now = date.today()
|
2019-06-14 19:50:59 +00:00
|
|
|
item = create_item(
|
|
|
|
SOURCE,
|
|
|
|
'{}-{}-{}'.format(now.year, now.month, now.day),
|
|
|
|
"Today is {}-{}-{}".format(now.year, now.month, now.day),
|
|
|
|
ts=time.time(),
|
|
|
|
body=args
|
|
|
|
)
|
2019-05-16 02:40:14 +00:00
|
|
|
return [item]
|