<?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 How to set time parameters and OAuth2 / Client Credentials in modular input python code? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/How-to-set-time-parameters-and-OAuth2-Client-Credentials-in/m-p/501985#M8997</link>
    <description>&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Here is the example they provide:&lt;/P&gt;

&lt;P&gt;# The following examples send rest requests to some endpoint.&lt;BR /&gt;
    response = helper.send_http_request(url, method, parameters=None, payload=None,&lt;BR /&gt;
                                        headers=None, cookies=None, verify=True, cert=None,&lt;BR /&gt;
                                        timeout=None, use_proxy=True)&lt;BR /&gt;
    # get the response headers&lt;BR /&gt;
    r_headers = response.headers&lt;BR /&gt;
    # get the response body as text&lt;BR /&gt;
    r_text = response.text&lt;BR /&gt;
    # get response body as json. If the body text is not a json string, raise a ValueError&lt;BR /&gt;
    r_json = response.json() will be getting the response as text&lt;BR /&gt;
    # get response cookies&lt;BR /&gt;
    r_cookies = response.cookies&lt;BR /&gt;
    # get redirect history&lt;BR /&gt;
    historical_responses = response.history&lt;BR /&gt;
    # get response status code&lt;BR /&gt;
    r_status = response.status_code&lt;BR /&gt;
    # check the response status, if the status is not sucessful, raise requests.HTTPError&lt;BR /&gt;
    response.raise_for_status()&lt;/P&gt;

&lt;P&gt;So far I have.. &lt;BR /&gt;
url = myurl&lt;BR /&gt;
method = get &lt;BR /&gt;
parameters = &lt;EM&gt;this is the part I need help with&lt;/EM&gt; &lt;BR /&gt;
response = helper.send_http_request(url, method, parameters=None, payload=None,&lt;BR /&gt;
                                        headers=None, cookies=None, verify=True, cert=None,&lt;BR /&gt;
                                        timeout=None, use_proxy=True)&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 03:16:22 GMT</pubDate>
    <dc:creator>kdanielsobrien</dc:creator>
    <dc:date>2020-09-30T03:16:22Z</dc:date>
    <item>
      <title>How to set time parameters and OAuth2 / Client Credentials in modular input python code?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/How-to-set-time-parameters-and-OAuth2-Client-Credentials-in/m-p/501985#M8997</link>
      <description>&lt;P&gt;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.&lt;/P&gt;

&lt;P&gt;Here is the example they provide:&lt;/P&gt;

&lt;P&gt;# The following examples send rest requests to some endpoint.&lt;BR /&gt;
    response = helper.send_http_request(url, method, parameters=None, payload=None,&lt;BR /&gt;
                                        headers=None, cookies=None, verify=True, cert=None,&lt;BR /&gt;
                                        timeout=None, use_proxy=True)&lt;BR /&gt;
    # get the response headers&lt;BR /&gt;
    r_headers = response.headers&lt;BR /&gt;
    # get the response body as text&lt;BR /&gt;
    r_text = response.text&lt;BR /&gt;
    # get response body as json. If the body text is not a json string, raise a ValueError&lt;BR /&gt;
    r_json = response.json() will be getting the response as text&lt;BR /&gt;
    # get response cookies&lt;BR /&gt;
    r_cookies = response.cookies&lt;BR /&gt;
    # get redirect history&lt;BR /&gt;
    historical_responses = response.history&lt;BR /&gt;
    # get response status code&lt;BR /&gt;
    r_status = response.status_code&lt;BR /&gt;
    # check the response status, if the status is not sucessful, raise requests.HTTPError&lt;BR /&gt;
    response.raise_for_status()&lt;/P&gt;

&lt;P&gt;So far I have.. &lt;BR /&gt;
url = myurl&lt;BR /&gt;
method = get &lt;BR /&gt;
parameters = &lt;EM&gt;this is the part I need help with&lt;/EM&gt; &lt;BR /&gt;
response = helper.send_http_request(url, method, parameters=None, payload=None,&lt;BR /&gt;
                                        headers=None, cookies=None, verify=True, cert=None,&lt;BR /&gt;
                                        timeout=None, use_proxy=True)&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:16:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/How-to-set-time-parameters-and-OAuth2-Client-Credentials-in/m-p/501985#M8997</guid>
      <dc:creator>kdanielsobrien</dc:creator>
      <dc:date>2020-09-30T03:16:22Z</dc:date>
    </item>
  </channel>
</rss>

