A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

base_task.py 880 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. class BaseTask(object):
  3. """A base class for bot tasks that edit Wikipedia."""
  4. task_name = None
  5. def __init__(self):
  6. """Constructor for new tasks.
  7. This is called once immediately after the task class is loaded by
  8. the task manager (in tasks._load_task()).
  9. """
  10. pass
  11. def run(self, **kwargs):
  12. """Main entry point to run a given task.
  13. This is called directly by tasks.start() and is the main way to make a
  14. task do stuff. kwargs will be any keyword arguments passed to start()
  15. which are entirely optional.
  16. The same task instance is preserved between runs, so you can
  17. theoretically store data in self (e.g.
  18. start('mytask', action='store', data='foo')) and then use it later
  19. (e.g. start('mytask', action='save')).
  20. """
  21. pass