inquisitor/sources/example.py

25 lines
565 B
Python
Raw Normal View History

2019-05-16 02:40:14 +00:00
"""
An example itemsource that produces an item with the current date.
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"
def fetch_new(state, args):
2019-05-16 02:40:14 +00:00
now = date.today()
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]