Skip to content
Merged

Proxy #171

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {{packageName}}
import re
import sys
import os

{{#hostName}}
def get_api_client(api_key_id, api_secret_file = None, private_key_string = None, proxy = None, endpoint="{{hostName}}"):
Expand All @@ -15,6 +16,12 @@ def get_api_client(api_key_id, api_secret_file = None, private_key_string = None
print("Please provide only one among api_secret_file or private_key_string")
sys.exit(1)

if proxy is None:
proxy = (os.getenv('HTTP_PROXY') or
os.getenv('http_proxy') or
os.getenv('HTTPS_PROXY') or
os.getenv('https_proxy'))

if api_secret_file is not None:
with open(api_secret_file, 'r') as f:
api_key = f.read()
Expand Down Expand Up @@ -45,5 +52,7 @@ def get_api_client(api_key_id, api_secret_file = None, private_key_string = None
]
)
)
if proxy:
configuration.proxy = proxy

return {{packageName}}.ApiClient(configuration)