Commits

Alexander Dudko committed 85128a7

communication with JIRA API via HTTPS

  • Participants
  • Parent commits b0a415a

Comments (0)

Files changed (2)

File bin/jira-bulk-loader.py

 parser.add_argument('--dry', dest='dry_run', action='store_true', help='Make a dry run. It checks everything but does not create tasks', default=False)
 
 mandatory = parser.add_argument_group('mandatory arguments')
-mandatory.add_argument('-H', dest='hostname', required=True, help='Jira hostname. Without http://')
+mandatory.add_argument('-H', dest='hostname', required=True, help='Jira hostname with http:// or https://')
 mandatory.add_argument('-U', dest='username', required=True, help='your Jira username')
 mandatory.add_argument('-P', dest='password', required=True, help='your Jira password')
 
 if args.priority: options['priority'] = {'name':args.priority}
 if args.project: options['project'] = {'key':args.project}
 
-jira_url = "http://" + args.hostname
-
-task_ext = TaskExtractor(jira_url, args.username, args.password, options, dry_run = args.dry_run)
+task_ext = TaskExtractor(args.hostname, args.username, args.password, options, dry_run = args.dry_run)
 
 try:
     print "Parsing task list.."

File jirabulkloader/task_extractor.py

 
         self.default_params = options
         self.dry_run = dry_run
-        self.jira_url = jira_url
+        self.jira_url = self._validate_url_and_type(jira_url)
+
+
+#####################################################################################
+# helpers for validate_load()
+
+    def _validate_url_and_type(self, url):
+        match = re.search("^https?://", url)
+        return url if match else "http://" + url
+
+# end of load() helpers
+#####################################################################################
 
 
     def validate_load(self, task_list):