Getting Data In

How do I import json module?

scottrunyon
Contributor

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?

0 Karma
1 Solution

scottrunyon
Contributor

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.

View solution in original post

0 Karma

scottrunyon
Contributor

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.

0 Karma
Get Updates on the Splunk Community!

Admin Your Splunk Cloud, Your Way

Join us to maximize different techniques to best tune Splunk Cloud. In this Tech Enablement, you will get ...

Cloud Platform | Discontinuing support for TLS version 1.0 and 1.1

Overview Transport Layer Security (TLS) is a security communications protocol that lets two computers, ...

New Customer Testimonials

Enterprises of all sizes and across different industries are accelerating cloud adoption by migrating ...