Hi Ron, Thank you for bringing this to our attention. The basic_auth_username and basic_auth_password values you were seeing were actually a relic of the past. As of today, these are removed from our examples.
As you noted, the API key is tied to a specific account. More details on API auth are available here <https://api-explorer.scalr.com/authentication/index.html>. Cheers, Wm. Marc O'Brien Scalr Technical Support On Monday, August 15, 2016 at 3:05:53 PM UTC-6, [email protected] wrote: > > I am trying to understand the code in the python examples for apiv2 ( > https://github.com/scalr-tutorials/apiv2-examples/tree/master/python). I > see in the credentials-sample.json file ( > https://github.com/scalr-tutorials/apiv2-examples/blob/master/python/credentials-sample.json) > > there are the url, key_id, key_secret and env_id, but there is no username > or password. Then in the main.py file ( > https://github.com/scalr-tutorials/apiv2-examples/blob/master/python/main.py) > it seems to be reading a username and password from the credentials file. > So what are the username and password in this case and should they be in > the creds file? I am wondering if the APIv2 key is tied to a specific > username/password or if a specific username/password should be used. > > credentials-sample.json: > > { > "api_url": "https://my.scalr.com", > "api_key_id": "API Key ID goes here", > "api_key_secret": "API Key Secret goes here", > "env_id": "Environment ID goes here" > } > > part of main.py: > > def main(credentials_file, scenario, log_level=logging.INFO): > # Setup credentials > with open(credentials_file) as f: > creds = json.load(f) > api_url, api_key_id, api_key_secret, env_id, basic_auth_username, > basic_auth_password = \ > [creds.get(k, "") for k in ["api_url", "api_key_id", > "api_key_secret", "env_id", *"basic_auth_username", "basic_auth_password"* > ]] > > client = ScalrApiClient(api_url.rstrip("/"), api_key_id, > api_key_secret) > client.logger.setLevel(log_level) > client.session.auth = requests.auth.HTTPBasicAuth(*basic_auth_username, > basic_auth_password*) > > > > Thanks! > Ron > -- You received this message because you are subscribed to the Google Groups "scalr-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
