Skip to content

Commit

Permalink
updating code to use env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
aahill committed Oct 14, 2019
1 parent 3b97156 commit fe8ba3b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions quickstarts/sdk/csharp-sdk-sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ class Program{

// <mainMethod>
static void Main(string[] args){
string location = "westus2";
string endpoint = $"https://{location}.api.cognitive.microsoft.com";
//This sample assumes you have created an environment variable for your key, named ANOMALY_DETECTOR_KEY
//This sample assumes you have created an environment variable for your key and endpoint
string endpoint = Environment.GetEnvironmentVariable(ANOMALY_DETECTOR_ENDPOINT);
string key = Environment.GetEnvironmentVariable("ANOMALY_DETECTOR_KEY");
string datapath = "request-data.csv";

Expand Down
9 changes: 4 additions & 5 deletions quickstarts/sdk/python-sdk-sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@
# </imports>

# <initVars>
# Set the COGSRV_ACCOUNT_KEY environment variable on your local machine using the
# appropriate method for your preferred shell (Bash, PowerShell, Command Prompt, etc.)
# This sample assumes you have created an environment variable for your key and endpoint
SUBSCRIPTION_KEY = os.environ["ANOMALY_DETECTOR_KEY"]
ANOMALY_DETECTION_LOCATION = "westus2"
ANOMALY_DETECTOR_ENDPOINT = os.environ["ANOMALY_DETECTOR_ENDPOINT"]

TIME_SERIES_DATA_PATH = "request-data.csv"
# </initVars>

# Create an Anomaly Detector client and add the

# <client>
base_url = "https://{}.api.cognitive.microsoft.com".format(ANOMALY_DETECTION_LOCATION)
client = AnomalyDetectorClient(base_url, CognitiveServicesCredentials(SUBSCRIPTION_KEY))
client = AnomalyDetectorClient(ANOMALY_DETECTOR_ENDPOINT, CognitiveServicesCredentials(SUBSCRIPTION_KEY))
# </client>

# Load in the time series data file
Expand Down

0 comments on commit fe8ba3b

Please sign in to comment.