<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Dear Predeep, <br>
    </p>
    <p>you need to authenticate against Keystone API.</p>
    <p>For example see
      <a class="moz-txt-link-freetext" href="https://docs.openstack.org/openstacksdk/wallaby/user/guides/connect.html">https://docs.openstack.org/openstacksdk/wallaby/user/guides/connect.html</a></p>
    <p>Best, Jani <br>
    </p>
    <div class="moz-cite-prefix">On 6/20/22 13:33, <a class="moz-txt-link-abbreviated" href="mailto:pspal83@hotmail.com">pspal83@hotmail.com</a>
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:SG2PR04MB3032A9D0C0283836E90B3C3DBAB09@SG2PR04MB3032.apcprd04.prod.outlook.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="ydp20a58638yahoo-style-wrap"
        style="font-family:Helvetica Neue, Helvetica, Arial,
        sans-serif;font-size:13px;">
        <div><br>
        </div>
        <div dir="ltr" data-setdir="false">
          <div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">Hi All,</div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">I am new to OpenStack SDA
              API and I need help.</div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">
              <div>While I am running my basic py file I am always
                getting the below error, Please suggest.</div>
              <div><br>
              </div>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">Code:</div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">
              <div>
                <div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap;"><div><span style="color: rgb(197, 134, 192);">import</span> openstack</div><div>
</div><div>conn = openstack.connect(<span style="color: rgb(156, 220, 254);">cloud</span>=<span style="color: rgb(206, 145, 120);">'openstack'</span>)</div><div>
</div><div><span style="color: rgb(197, 134, 192);">for</span> server <span style="color: rgb(197, 134, 192);">in</span> conn.compute.servers():</div><div>    <span style="color: rgb(220, 220, 170);">print</span>(server.to_dict())</div></div>
              </div>
              <br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><b><font color="#cd232c">Error:</font></b></div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
            </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;">[pke@vm01 ~]$ python
              openstack-connect.py </div>
            <div dir="ltr" style="font-family: Helvetica Neue,
              Helvetica, Arial, sans-serif;"><br>
              <div>
                <div>Traceback (most recent call last):</div>
                <div>  File "openstack-connect.py", line 7, in
                  <module></div>
                <div>    for server in conn.compute.servers():</div>
                <div>  File
"/usr/local/lib/python3.6/site-packages/openstack/service_description.py",
                  line 87, in __get__</div>
                <div>    proxy = self._make_proxy(instance)</div>
                <div>  File
"/usr/local/lib/python3.6/site-packages/openstack/service_description.py",
                  line 262, in _make_proxy</div>
                <div>    found_version =
                  temp_adapter.get_api_major_version()</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/adapter.py",
                  line 354, in get_api_major_version</div>
                <div>    return self.session.get_api_major_version(auth
                  or self.auth, **kwargs)</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                  line 1276, in get_api_major_version</div>
                <div>    return auth.get_api_major_version(self,
                  **kwargs)</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                  line 500, in get_api_major_version</div>
                <div>    data =
                  get_endpoint_data(discover_versions=discover_versions)</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                  line 271, in get_endpoint_data</div>
                <div>    service_catalog =
                  self.get_access(session).service_catalog</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                  line 134, in get_access</div>
                <div>    self.auth_ref = self.get_auth_ref(session)</div>
                <div>  File
"/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/generic/base.py",
                  line 208, in get_auth_ref</div>
                <div>    return self._plugin.get_auth_ref(session,
                  **kwargs)</div>
                <div>  File
"/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/v3/base.py",
                  line 188, in get_auth_ref</div>
                <div>    authenticated=False, log=False, **rkwargs)</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                  line 1149, in post</div>
                <div>    return self.request(url, 'POST', **kwargs)</div>
                <div>  File
                  "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                  line 986, in request</div>
                <div>    raise exceptions.from_response(resp, method,
                  url)</div>
                <div>keystoneauth1.exceptions.http.Unauthorized: The
                  request you have made requires authentication. (HTTP
                  401) (Request-ID:
                  req-0e898e09-0dbc-4beb-8414-8dcdc4f6631e)</div>
              </div>
              <div><br>
              </div>
              <div><br>
              </div>
              <div dir="ltr">Regards</div>
              <div dir="ltr">Pradeep Kumar</div>
            </div>
          </div>
        </div>
      </div>
      <div id="yahoo_quoted_6340826558" class="yahoo_quoted">
        <div style="font-family:'Helvetica Neue', Helvetica, Arial,
          sans-serif;font-size:13px;color:#26282a;">
          <div> On Monday, 20 June, 2022, 04:54:19 pm IST,
            <a class="moz-txt-link-abbreviated" href="mailto:pspal83@hotmail.com">pspal83@hotmail.com</a> <a class="moz-txt-link-rfc2396E" href="mailto:pspal83@hotmail.com"><pspal83@hotmail.com></a> wrote: </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>
            <div id="yiv9108579506">
              <div>
                <div style="font-family:Helvetica Neue, Helvetica,
                  Arial, sans-serif;font-size:13px;"
                  class="yiv9108579506yahoo-style-wrap">
                  <div dir="ltr">Hi All,</div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr">I am new to OpenStack SDA API and I
                    need help.</div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr">
                    <div>
                      <div>While I am running my basic py file I am
                        always getting the below error, Please suggest.</div>
                      <div><br>
                      </div>
                    </div>
                  </div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr">Code:</div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr">
                    <div>
                      <div style="color:rgb(212, 212, 212);background-color:rgb(30, 30, 30);font-family:Consolas, monospace;font-size:14px;line-height:19px;white-space:pre-wrap;"><div><span style="color:#c586c0;">import</span> openstack</div><div>
</div><div>conn = openstack.connect(<span style="color:#9cdcfe;">cloud</span>=<span style="color:#ce9178;">'openstack'</span>)</div><div>
</div><div><span style="color:#c586c0;">for</span> server <span style="color:#c586c0;">in</span> conn.compute.servers():</div><div>    <span style="color:#dcdcaa;">print</span>(server.to_dict())</div></div>
                    </div>
                    <br>
                  </div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr"><b><font color="#cd232c">Error:</font></b></div>
                  <div dir="ltr"><br>
                  </div>
                  <div dir="ltr">[pke@vm01 ~]$ python
                    openstack-connect.py </div>
                  <div dir="ltr"><br>
                    <div>
                      <div>Traceback (most recent call last):</div>
                      <div>  File "openstack-connect.py", line 7, in
                        <module></div>
                      <div>    for server in conn.compute.servers():</div>
                      <div>  File
"/usr/local/lib/python3.6/site-packages/openstack/service_description.py",
                        line 87, in __get__</div>
                      <div>    proxy = self._make_proxy(instance)</div>
                      <div>  File
"/usr/local/lib/python3.6/site-packages/openstack/service_description.py",
                        line 262, in _make_proxy</div>
                      <div>    found_version =
                        temp_adapter.get_api_major_version()</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/adapter.py",
                        line 354, in get_api_major_version</div>
                      <div>    return
                        self.session.get_api_major_version(auth or
                        self.auth, **kwargs)</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                        line 1276, in get_api_major_version</div>
                      <div>    return auth.get_api_major_version(self,
                        **kwargs)</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                        line 500, in get_api_major_version</div>
                      <div>    data =
                        get_endpoint_data(discover_versions=discover_versions)</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                        line 271, in get_endpoint_data</div>
                      <div>    service_catalog =
                        self.get_access(session).service_catalog</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/base.py",
                        line 134, in get_access</div>
                      <div>    self.auth_ref =
                        self.get_auth_ref(session)</div>
                      <div>  File
"/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/generic/base.py",
                        line 208, in get_auth_ref</div>
                      <div>    return self._plugin.get_auth_ref(session,
                        **kwargs)</div>
                      <div>  File
"/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/v3/base.py",
                        line 188, in get_auth_ref</div>
                      <div>    authenticated=False, log=False,
                        **rkwargs)</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                        line 1149, in post</div>
                      <div>    return self.request(url, 'POST',
                        **kwargs)</div>
                      <div>  File
                        "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py",
                        line 986, in request</div>
                      <div>    raise exceptions.from_response(resp,
                        method, url)</div>
                      <div>keystoneauth1.exceptions.http.Unauthorized:
                        The request you have made requires
                        authentication. (HTTP 401) (Request-ID:
                        req-0e898e09-0dbc-4beb-8414-8dcdc4f6631e)</div>
                    </div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div dir="ltr">Regards</div>
                    <div dir="ltr">Pradeep Kumar</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>