def __init__(self, username, password): self.output_dir = "output/" self.database = "database.json" self.db = {} self.moodle = Moodle(username, password) if not self.moodle.login(): exit() self.initDatabase()
def __init__(self, username, password, chat_id): self.username = username self.password = password self.chat_id = chat_id self.moodle = Moodle() self.can_upload = False self.data = {}
help="Password to use to connect") parser.add_argument('--config', dest='config', help='config file to load', default='moodle.cfg') parser.add_argument('--url', dest='url', help='moodle base url', default='https://csimoodle.ucd.ie/moodle/') parser.add_argument('category', help="The category to check", default='TEST 2') args = parser.parse_args() config = ConfigParser.ConfigParser() config.read([args.config, os.path.expanduser('~/.moodleapi.cfg')]) username = config.get("account", "user") password = config.get("account", "pass") course = args.course if args.user: username = parser.user if args.password: password = args.password m = Moodle(args.url) m.login(username, password) m.course = course m.check_questions(args.category, verify)
# COPYRIGHT (C) 2019 Henrik A. Christensen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. from getpass import getpass from moodle import Moodle if __name__ == '__main__': calmoodle_id = int(input('Enter calmoodle id: ')) moodle = Moodle() days = moodle.get_schedule(calmoodle_id)