Skip to content

Commit

Permalink
Adding ssl verification
Browse files Browse the repository at this point in the history
  • Loading branch information
momchil-flex committed Jun 28, 2023
1 parent aba75a2 commit 4652dd3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tidy3d/web/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
import json
import os.path
import ssl

import click
import requests
Expand Down Expand Up @@ -90,7 +91,13 @@ def auth(req):
message = f"Current API key: [{current_apikey}]\n" if current_apikey else ""
apikey = click.prompt(f"{message}Please enter your api key", type=str)

resp = requests.get(f"{Env.current.web_api_endpoint}/apikey", auth=auth, verify=False)
try:
resp = requests.get(
f"{Env.current.web_api_endpoint}/apikey", auth=auth, verify=Env.current.ssl_verify
)
except (requests.exceptions.SSLError, ssl.SSLError):
resp = requests.get(f"{Env.current.web_api_endpoint}/apikey", auth=auth, verify=False)

if resp.status_code == 200:
click.echo("Configured successfully.")
with open(CONFIG_FILE, "w+", encoding="utf-8") as config_file:
Expand Down

0 comments on commit 4652dd3

Please sign in to comment.