2 """Updates the wrsledrunjsoncache table (by calling wrpylib.wrmwcache.update_wrsledrunjsoncache()).
5 $ python updatewrsledrunjsoncache.py inifile1.ini ...
7 One or more .ini configuration files can be given.
8 At the end, the following entries have to be present:
12 dbname=philipp_winterrodeln_wiki
17 wikiurl=https://www.winterrodeln.org/mediawiki/api.php
22 from sqlalchemy.engine import create_engine
23 import wrpylib.wrmwcache
26 def update_wrsledrunjsoncache(inifile):
28 :param inifile: filename of an .ini file or a list of .ini files.
30 config = configparser.ConfigParser()
33 host = config.get('mysql', 'host')
34 dbname = config.get('mysql', 'dbname')
35 user = config.get('mysql', 'user_name')
36 passwd = config.get('mysql', 'user_pass')
38 engine = create_engine(f'mysql://{user}@{host}:3306/{dbname}?passwd={passwd}&charset=utf8mb4')
39 api_url = urllib.parse.urlparse(config.get('robot', 'wikiurl'))
40 wrpylib.wrmwcache.update_wrsledrunjsoncache(api_url, engine.connect())
43 if __name__ == '__main__':
44 parser = argparse.ArgumentParser(description='Updates the wrsledrunjsoncache table.')
45 parser.add_argument('inifile', nargs='+', help='inifile.ini, see: https://www.winterrodeln.org/trac/wiki/ConfigIni')
46 args = parser.parse_args()
47 update_wrsledrunjsoncache(args.inifile)