<?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 Reset token from tokens.py in splunk REST app in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Reset-token-from-tokens-py-in-splunk-REST-app/m-p/408158#M72370</link>
    <description>&lt;P&gt;I need some help, I am using version 1.5.3 of the splunk Rest App, how can I reset the tokens.py ?, in the url of my endpoint&lt;BR /&gt;
I need to change the date to the current date and configure the tockens.py of the following&lt;BR /&gt;
way and it works, only that it works when I restart the whole environment and would like it to be according to tokens.py.&lt;/P&gt;

&lt;P&gt;def datetoday():&lt;BR /&gt;
    today = datetime.date.today()&lt;BR /&gt;
    return today.strftime('%Y.%m.%d')&lt;/P&gt;

&lt;P&gt;This is my original URL:&lt;BR /&gt;
&lt;A href="http://server:port/process.external.registerlocationupdaterequest-2019.01.07/_search?pretty"&gt;http://server:port/process.external.registerlocationupdaterequest-2019.01.07/_search?pretty&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This is my URL with token added:&lt;BR /&gt;
&lt;A href="http://server:port/process.external.registerlocationupdaterequest-$datetoday$/_search?pretty"&gt;http://server:port/process.external.registerlocationupdaterequest-$datetoday$/_search?pretty&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;try adding the following class in responsehandlers.py to force the token as I saw it in the next&lt;BR /&gt;
Dennis answer: &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/311261/rest-api-modular-input-app-tokens-not-resetting.html"&gt;https://answers.splunk.com/answers/311261/rest-api-modular-input-app-tokens-not-resetting.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;it just did not work and I did not leave any error message.&lt;/P&gt;

&lt;P&gt;class MyTokenResponseHandler:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;def __init__(self,**args):
     pass

 def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):

     print_xml_stream(raw_response_output)

     today = datetime.now()
     time_fmt = '%Y.%m.%d'

     if not "params" in req_args:
     req_args["params"] = {}
     req_args["params"]["datetoday"] = today.strftime(time_fmt)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;also try adding the following lines in the rest.py as it says damien.branger, but it did not work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        original_endpoint=config.get("endpoint")
        #token replacement
        endpoint_list = replaceTokens(original_endpoint)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I already reexpress the documentation and I can not find more information, someone who could support me, I would really appreciate it.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jan 2019 19:22:07 GMT</pubDate>
    <dc:creator>joseag</dc:creator>
    <dc:date>2019-01-17T19:22:07Z</dc:date>
    <item>
      <title>Reset token from tokens.py in splunk REST app</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Reset-token-from-tokens-py-in-splunk-REST-app/m-p/408158#M72370</link>
      <description>&lt;P&gt;I need some help, I am using version 1.5.3 of the splunk Rest App, how can I reset the tokens.py ?, in the url of my endpoint&lt;BR /&gt;
I need to change the date to the current date and configure the tockens.py of the following&lt;BR /&gt;
way and it works, only that it works when I restart the whole environment and would like it to be according to tokens.py.&lt;/P&gt;

&lt;P&gt;def datetoday():&lt;BR /&gt;
    today = datetime.date.today()&lt;BR /&gt;
    return today.strftime('%Y.%m.%d')&lt;/P&gt;

&lt;P&gt;This is my original URL:&lt;BR /&gt;
&lt;A href="http://server:port/process.external.registerlocationupdaterequest-2019.01.07/_search?pretty"&gt;http://server:port/process.external.registerlocationupdaterequest-2019.01.07/_search?pretty&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This is my URL with token added:&lt;BR /&gt;
&lt;A href="http://server:port/process.external.registerlocationupdaterequest-$datetoday$/_search?pretty"&gt;http://server:port/process.external.registerlocationupdaterequest-$datetoday$/_search?pretty&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;try adding the following class in responsehandlers.py to force the token as I saw it in the next&lt;BR /&gt;
Dennis answer: &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/311261/rest-api-modular-input-app-tokens-not-resetting.html"&gt;https://answers.splunk.com/answers/311261/rest-api-modular-input-app-tokens-not-resetting.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;it just did not work and I did not leave any error message.&lt;/P&gt;

&lt;P&gt;class MyTokenResponseHandler:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;def __init__(self,**args):
     pass

 def __call__(self, response_object,raw_response_output,response_type,req_args,endpoint):

     print_xml_stream(raw_response_output)

     today = datetime.now()
     time_fmt = '%Y.%m.%d'

     if not "params" in req_args:
     req_args["params"] = {}
     req_args["params"]["datetoday"] = today.strftime(time_fmt)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;also try adding the following lines in the rest.py as it says damien.branger, but it did not work.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        original_endpoint=config.get("endpoint")
        #token replacement
        endpoint_list = replaceTokens(original_endpoint)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I already reexpress the documentation and I can not find more information, someone who could support me, I would really appreciate it.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 19:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Reset-token-from-tokens-py-in-splunk-REST-app/m-p/408158#M72370</guid>
      <dc:creator>joseag</dc:creator>
      <dc:date>2019-01-17T19:22:07Z</dc:date>
    </item>
  </channel>
</rss>

