Instead oftoday = datetime(year=2017, month=1, day=27)
should betoday = datetime.date(year=2017, month=1, day=27)
Bogdan Maties