<?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 script will only succeed every now and again in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Python-script-will-only-succeed-every-now-and-again/m-p/202733#M2723</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I wrote a Python script to retrieve JSON data from a REST API. The script fetches the JSON with the urllib2-module and does some parsing with the json-module. When I call the Python-script directly via the command line, it will always succeed.&lt;/P&gt;

&lt;P&gt;However, if I'm calling it with Splunk's Python via &lt;EM&gt;/opt/splunk/bin/splunk cmd python /path/to/myscript.py&lt;/EM&gt;, the script will only work on every third or fourth run. It will fail when retrieving the data with HTTP Error 400.&lt;/P&gt;

&lt;P&gt;Used imports in the script:  os, os.path, re, ast, csv, sys,  json, logging, argparse, ConfigParser, urllib2&lt;/P&gt;

&lt;P&gt;Do you have an idea what might be happening here? How can I troubleshoot this?&lt;BR /&gt;
Many thanks!&lt;/P&gt;

&lt;P&gt;It fails with Splunk 6.1.3 and its Python 2.7&lt;BR /&gt;
Script works fine with OS Python 2.6.9&lt;/P&gt;</description>
    <pubDate>Fri, 12 Feb 2016 15:31:15 GMT</pubDate>
    <dc:creator>ssauler</dc:creator>
    <dc:date>2016-02-12T15:31:15Z</dc:date>
    <item>
      <title>Python script will only succeed every now and again</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-script-will-only-succeed-every-now-and-again/m-p/202733#M2723</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I wrote a Python script to retrieve JSON data from a REST API. The script fetches the JSON with the urllib2-module and does some parsing with the json-module. When I call the Python-script directly via the command line, it will always succeed.&lt;/P&gt;

&lt;P&gt;However, if I'm calling it with Splunk's Python via &lt;EM&gt;/opt/splunk/bin/splunk cmd python /path/to/myscript.py&lt;/EM&gt;, the script will only work on every third or fourth run. It will fail when retrieving the data with HTTP Error 400.&lt;/P&gt;

&lt;P&gt;Used imports in the script:  os, os.path, re, ast, csv, sys,  json, logging, argparse, ConfigParser, urllib2&lt;/P&gt;

&lt;P&gt;Do you have an idea what might be happening here? How can I troubleshoot this?&lt;BR /&gt;
Many thanks!&lt;/P&gt;

&lt;P&gt;It fails with Splunk 6.1.3 and its Python 2.7&lt;BR /&gt;
Script works fine with OS Python 2.6.9&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 15:31:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-script-will-only-succeed-every-now-and-again/m-p/202733#M2723</guid>
      <dc:creator>ssauler</dc:creator>
      <dc:date>2016-02-12T15:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python script will only succeed every now and again</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-script-will-only-succeed-every-now-and-again/m-p/202734#M2724</link>
      <description>&lt;P&gt;No need to reinvent the wheel. &lt;A href="https://splunkbase.splunk.com/app/1546/"&gt;Use the REST API Modular Input.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Feb 2016 16:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-script-will-only-succeed-every-now-and-again/m-p/202734#M2724</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2016-02-12T16:08:00Z</dc:date>
    </item>
  </channel>
</rss>

