Splunk Dev

How to set time parameters and OAuth2 / Client Credentials in modular input python code?

kdanielsobrien
Explorer

I am attempting to write a modular input using python code. The helper code has examples for you to use.. I'm new to python and splunk so I was wondering if someone could help me with the parameters.. The parameters are a start and end time. How would I define/set the parameters? I also need to pass through OAuth2 and Client credentials.

Here is the example they provide:

# The following examples send rest requests to some endpoint.
response = helper.send_http_request(url, method, parameters=None, payload=None,
headers=None, cookies=None, verify=True, cert=None,
timeout=None, use_proxy=True)
# get the response headers
r_headers = response.headers
# get the response body as text
r_text = response.text
# get response body as json. If the body text is not a json string, raise a ValueError
r_json = response.json() will be getting the response as text
# get response cookies
r_cookies = response.cookies
# get redirect history
historical_responses = response.history
# get response status code
r_status = response.status_code
# check the response status, if the status is not sucessful, raise requests.HTTPError
response.raise_for_status()

So far I have..
url = myurl
method = get
parameters = this is the part I need help with
response = helper.send_http_request(url, method, parameters=None, payload=None,
headers=None, cookies=None, verify=True, cert=None,
timeout=None, use_proxy=True)

Labels (2)
0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...