add username and password commandline opts to budget-sync
[utils.git] / src / budget_sync / main.py
index 258e0a5ca6cad5d226bfbe6ac8078b1065ac4293..c8929aff18d27d400436809078deba0ecd692188 100644 (file)
@@ -23,6 +23,8 @@ def main():
         help="The path to the output directory, will be created if it "
         "doesn't exist",
         dest="output_dir", metavar="<path/to/output/dir>")
+    parser.add_argument('--username', help="Log in with this username")
+    parser.add_argument('--password', help="Log in with this password")
     args = parser.parse_args()
     try:
         with args.config as config_file:
@@ -32,6 +34,9 @@ def main():
         return
     logging.info("Using Bugzilla instance at %s", config.bugzilla_url)
     bz = Bugzilla(config.bugzilla_url)
+    if args.username:
+        logging.debug("logging in...")
+        bz.interactive_login(args.username, args.password)
     logging.debug("Connected to Bugzilla")
     budget_graph = BudgetGraph(all_bugs(bz), config)
     for error in budget_graph.get_errors():