From 691e8012ec6beaa5ae95671dbceb974bad4b47d1 Mon Sep 17 00:00:00 2001 From: sshugsc Date: Wed, 9 Apr 2025 16:31:45 -0700 Subject: [PATCH] check projects in async upload --- pori_python/ipr/connection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pori_python/ipr/connection.py b/pori_python/ipr/connection.py index d85ebf7..fe5683d 100644 --- a/pori_python/ipr/connection.py +++ b/pori_python/ipr/connection.py @@ -101,6 +101,14 @@ def upload_report( # if async is used, the response for reports-async contains either 'jobStatus' # or 'report'. jobStatus is no longer available once the report is successfully # uploaded. + + projects = self.get("project") + project_names = [item['name'] for item in projects] + + # if project is not exist, create one + if content['project'] not in project_names: + self.post("project", {'name': content['project']}) + initial_result = self.post("reports-async", content) report_id = initial_result["ident"]