Skip to content

Commit

Permalink
set shotgrid certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementHector committed Feb 7, 2022
1 parent d11b089 commit f342365
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class CollectShotgridSession(pyblish.api.ContextPlugin):
label = "Shotgrid user session"

def process(self, context):
set_shotgrid_certificate()

avalon_project = os.getenv("AVALON_PROJECT")

shotgrid_settings = get_shotgrid_settings(avalon_project)
Expand Down Expand Up @@ -51,6 +53,21 @@ def process(self, context):
context.data['shotgridSession'] = session


def get_shotgrid_certificate():
shotgun_api_path = os.path.dirname(shotgun_api3.__file__)
certificate_path = os.path.join( shotgun_api_path, "lib", "certifi", "cacert.pem")
if not os.path.exists(certificate_path):
raise FileExistsError("Could not find certificate in shotgun_api3: \
{}".format(certificate_path))
return certificate_path


def set_shotgrid_certificate():
if not os.getenv("SHOTGUN_API_CACERTS"):
certificate = get_shotgrid_certificate()
os.environ["SHOTGUN_API_CACERTS"] = certificate


def get_shotgrid_settings(project):
return get_project_settings(project).get('shotgrid', {})

Expand Down

0 comments on commit f342365

Please sign in to comment.