Olen/Spond

attendance.py sample script: -f and -t arguments are specified as optional, but code requires them

Closed this issue · 3 comments

Version 0.0.6
When run with no arguments:

(venv37) C:\Users\Elliot\dev\Spond>attendance.py   
Traceback (most recent call last):
  File "C:\Users\Elliot\dev\Spond\attendance.py", line 59, in <module>
    loop.run_until_complete(main())
  File "C:\Users\Elliot\AppData\Local\Programs\Python\Python37\lib\asyncio\base_events.py", line 587, in run_until_complete
    return future.result()
  File "C:\Users\Elliot\dev\Spond\attendance.py", line 17, in main
    events = await s.getEventsBetween(args.f, args.t)
  File "C:\Users\Elliot\dev\Spond\spond\spond.py", line 174, in getEventsBetween
    f"{self.apiurl}sponds/?"
AttributeError: 'NoneType' object has no attribute 'strftime'
Olen commented

They should probably have some sane defaults.

from = today, to = from + 7 days or something

Pull request to fix:
#32

get_events doesn't have any required parameters, so this fixes the issue as stated,

(I think get_events defaults are fine as they are, already limits to 100 events. It doesn't make sense to me to override what the API returns unless there is good reason. Personally, my scripts look at a large date range to e.g. determine when a member last participated.)

However, the script doesn't complete for me on Windows. I think because ":" appears in timestamps, but is an illegal character in filenames, but one for a separate issue.

Fixed