inquisitor/sources/example.py

22 lines
532 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
def fetch_new(state, args):
2019-05-16 02:40:14 +00:00
now = date.today()
item = create_item(
2019-06-19 20:32:23 +00:00
"example",
'{}-{}-{}'.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]