<?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 Re: Authentication error while running python script with office365 module. in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453270#M8260</link>
    <description>&lt;P&gt;Yes, I downloaded Everything and Imported the needed resources. It was actually working when running outside Splunk so It means that there are no problem with the package.&lt;/P&gt;

&lt;P&gt;But luckily, I got the fix now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html"&gt;https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I just need to create a shell script to trigger my python script from outside Splunk's Python..&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2019 07:10:38 GMT</pubDate>
    <dc:creator>darljed</dc:creator>
    <dc:date>2019-05-13T07:10:38Z</dc:date>
    <item>
      <title>Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453264#M8254</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;Need help. I am trying to create a custom python script with has a dependecy on office365 (&lt;A href="https://github.com/vgrem/Office365-REST-Python-Client" target="_blank"&gt;https://github.com/vgrem/Office365-REST-Python-Client&lt;/A&gt;) module. The script was creating REST API calls to SharePoint to update, delete, add items to it. I am using client ID and client secret as Credentials to access SharePoint. The script will be triggered by a Scheduled Search.&lt;/P&gt;
&lt;P&gt;I placed the file on &lt;CODE&gt;$SPLUNK_HOME/etc/apps/&amp;lt;appname&amp;gt;/bin/&lt;/CODE&gt; both the script and the office365 folder.&lt;/P&gt;
&lt;P&gt;When I try to run the script using &lt;CODE&gt;python scriptName.py&lt;/CODE&gt; on that directory, It is working fine so I expected that It will work the same when the script was triggered from Splunk. But no. I am getting authentication error.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):
  File "sharepoint_fetch_data.py", line 100, in &amp;lt;module&amp;gt;
    print ("ingestion error: {0}".format(ctx_auth.get_last_error()))
  File "/opt/splunk/etc/apps/sharepoint_connector/bin/office365/runtime/auth/authentication_context.py", line 37, in get_last_error
    return self.provider.get_last_error()
AttributeError: 'ACSTokenProvider' object has no attribute 'get_last_error'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which I am not getting when I run It using &lt;CODE&gt;python scriptName.py&lt;/CODE&gt; only.&lt;/P&gt;
&lt;P&gt;I also tried to run the script using &lt;CODE&gt;$SPLUNK_HOME/bin/splunk cmd python scriptName.py&lt;/CODE&gt; and the errors were the same. It seems that I am getting the error when running it with Splunk's python. Like blocking the connection or something... I don't know.&lt;/P&gt;
&lt;P&gt;Did I missed to do or configure something ? Please help me. Thanks in advance!!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 18:16:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453264#M8254</guid>
      <dc:creator>darljed</dc:creator>
      <dc:date>2020-06-18T18:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453265#M8255</link>
      <description>&lt;P&gt;Hi @darljed,&lt;/P&gt;

&lt;P&gt;It seems like the Splunk Python could be missing some of the functions used by that script. Try updating your script to make it use the system's python :&lt;BR /&gt;
&lt;A href="https://stackoverflow.com/questions/3108285/in-python-script-how-do-i-set-pythonpath"&gt;https://stackoverflow.com/questions/3108285/in-python-script-how-do-i-set-pythonpath&lt;/A&gt;&lt;BR /&gt;
This should solve your problem.&lt;/P&gt;

&lt;P&gt;PS: This could also be because you're running the script as root and Splunk is running it as the Splunk user ? &lt;/P&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Sun, 12 May 2019 20:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453265#M8255</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-12T20:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453266#M8256</link>
      <description>&lt;P&gt;I guess you're right about Splunk's python could be missing something... I also tried setting up &lt;CODE&gt;sys.path&lt;/CODE&gt; but still it will use Splunk's Python.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 05:48:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453266#M8256</guid>
      <dc:creator>darljed</dc:creator>
      <dc:date>2019-05-13T05:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453267#M8257</link>
      <description>&lt;P&gt;Thanks Anyway &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 05:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453267#M8257</guid>
      <dc:creator>darljed</dc:creator>
      <dc:date>2019-05-13T05:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453268#M8258</link>
      <description>&lt;P&gt;You're welcome. I also checked the git repository you linked. It seems that &lt;CODE&gt;get_last_error&lt;/CODE&gt; is in &lt;CODE&gt;office365/runtime/auth/authentication_context.py&lt;/CODE&gt; did you grab the entire repository or just the files you need ? Could be a good idea to import the whole thing and try it out with all the code there.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 06:59:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453268#M8258</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-13T06:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453269#M8259</link>
      <description>&lt;P&gt;I got the fix now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html"&gt;https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So I just need to create a shell script to trigger my python script.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 07:07:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453269#M8259</guid>
      <dc:creator>darljed</dc:creator>
      <dc:date>2019-05-13T07:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453270#M8260</link>
      <description>&lt;P&gt;Yes, I downloaded Everything and Imported the needed resources. It was actually working when running outside Splunk so It means that there are no problem with the package.&lt;/P&gt;

&lt;P&gt;But luckily, I got the fix now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html"&gt;https://answers.splunk.com/answers/2821/python-scripted-inputs-run-with-the-wrong-version-of-python-in-splunk-4-1-2.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I just need to create a shell script to trigger my python script from outside Splunk's Python..&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 07:10:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453270#M8260</guid>
      <dc:creator>darljed</dc:creator>
      <dc:date>2019-05-13T07:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication error while running python script with office365 module.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453271#M8261</link>
      <description>&lt;P&gt;Awesome ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 07:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Authentication-error-while-running-python-script-with-office365/m-p/453271#M8261</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-13T07:17:09Z</dc:date>
    </item>
  </channel>
</rss>

