i am trying to write a python script to get data from a external API.
When I execute the script in Splunk, it fails on json.
The basic format of the script is -
import sys
import requests
import json
import splunk.Intersplunk as si
.
.
.
token_url = base_url+'/security/getToken'
payload = {'xxx': key,'yyy': user,'zzz': pwd}
r = requests.post(token_url, json = payload)
token = r.text.replace('"',"")
How do I import the json module?
To solve this problem, I set up a Windows bat file to execute a .py file that saves the data into a json file on the local drive. Splunk monitors this file without any issues.
To solve this problem, I set up a Windows bat file to execute a .py file that saves the data into a json file on the local drive. Splunk monitors this file without any issues.