<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python SWAT Viya 4 Oauth token in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Python-SWAT-Viya-4-Oauth-token/m-p/950211#M10956</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I am attempting to connect to CAS Innovation Lab with a token as documented here &lt;A href="https://sassoftware.github.io/python-swat/getting-started.html#oauth-token" target="_blank"&gt;https://sassoftware.github.io/python-swat/getting-started.html#oauth-token&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;s = swat.CAS('&lt;A href="https://innovationlab.demo.sas.com/cas-shared-default-http/" target="_blank"&gt;https://innovationlab.demo.sas.com/cas-shared-default-http/&lt;/A&gt;', authcode="XXXX")&lt;/P&gt;
&lt;P&gt;The acion fails with DS2 PYMAS failure in the 'execute' method&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SWAT version in the Innovate Lab is not 1.14 but that should not make a difference&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;import swat&lt;/P&gt;
&lt;P&gt;access_token =’……….’&lt;/P&gt;
&lt;P&gt;httpconn = swat.CAS(&lt;A href="https://innovationlab.demo.sas.com/cas-shared-default-http/" target="_blank"&gt;https://innovationlab.demo.sas.com/cas-shared-default-http/&lt;/A&gt;, username=None, password=access_token, ssl_ca_list="C:/Users/XXXX/OneDrive - SAS/Documents/XXXX/lab-rootCA-Intermidiates_4CLI.pem", protocol="https")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The challenge is how to use this *same code* in Model Manager (MM) and Intelligent Decisioning (ID) within the Innovation Lab.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Within the Python Code Node in Python, I tried every version documented and still received an error. It appears that the problem is how the Innovation Lab would recognise the ‘certificate’.&lt;BR /&gt;&lt;BR /&gt;The issue first occurred when Viya 4 switched to accessing SWAT from ID/PW to access tokens.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I think that this error would occur with anyone using SWAT in MM/ID in any environment. I have confirmed with the Innovation Lab admins that the environment is configured to run Python.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I comment out the call to SWAT, the code works. However, that does not help. When I used ID and PW to call SWAT from MM/ID, it all worked. Is there a way to keep using this workflow?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Nov 2024 13:59:40 GMT</pubDate>
    <dc:creator>ripuli</dc:creator>
    <dc:date>2024-11-08T13:59:40Z</dc:date>
    <item>
      <title>Python SWAT Viya 4 Oauth token</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Python-SWAT-Viya-4-Oauth-token/m-p/950211#M10956</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I am attempting to connect to CAS Innovation Lab with a token as documented here &lt;A href="https://sassoftware.github.io/python-swat/getting-started.html#oauth-token" target="_blank"&gt;https://sassoftware.github.io/python-swat/getting-started.html#oauth-token&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;s = swat.CAS('&lt;A href="https://innovationlab.demo.sas.com/cas-shared-default-http/" target="_blank"&gt;https://innovationlab.demo.sas.com/cas-shared-default-http/&lt;/A&gt;', authcode="XXXX")&lt;/P&gt;
&lt;P&gt;The acion fails with DS2 PYMAS failure in the 'execute' method&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The SWAT version in the Innovate Lab is not 1.14 but that should not make a difference&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;import swat&lt;/P&gt;
&lt;P&gt;access_token =’……….’&lt;/P&gt;
&lt;P&gt;httpconn = swat.CAS(&lt;A href="https://innovationlab.demo.sas.com/cas-shared-default-http/" target="_blank"&gt;https://innovationlab.demo.sas.com/cas-shared-default-http/&lt;/A&gt;, username=None, password=access_token, ssl_ca_list="C:/Users/XXXX/OneDrive - SAS/Documents/XXXX/lab-rootCA-Intermidiates_4CLI.pem", protocol="https")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;The challenge is how to use this *same code* in Model Manager (MM) and Intelligent Decisioning (ID) within the Innovation Lab.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Within the Python Code Node in Python, I tried every version documented and still received an error. It appears that the problem is how the Innovation Lab would recognise the ‘certificate’.&lt;BR /&gt;&lt;BR /&gt;The issue first occurred when Viya 4 switched to accessing SWAT from ID/PW to access tokens.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I think that this error would occur with anyone using SWAT in MM/ID in any environment. I have confirmed with the Innovation Lab admins that the environment is configured to run Python.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I comment out the call to SWAT, the code works. However, that does not help. When I used ID and PW to call SWAT from MM/ID, it all worked. Is there a way to keep using this workflow?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 13:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Python-SWAT-Viya-4-Oauth-token/m-p/950211#M10956</guid>
      <dc:creator>ripuli</dc:creator>
      <dc:date>2024-11-08T13:59:40Z</dc:date>
    </item>
  </channel>
</rss>

