<?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>question Re: Not able to start processor group through Python requests (Rest api) in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288032#M213409</link>
    <description>&lt;P&gt;You should be able to accept your own reply as solution marking it closed/solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing I do notice, which I HIGHLY recommend against is using "localhost"... &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2020 14:06:34 GMT</pubDate>
    <dc:creator>stevenmatison</dc:creator>
    <dc:date>2020-01-21T14:06:34Z</dc:date>
    <item>
      <title>Not able to start processor group through Python requests (Rest api)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288000#M213382</link>
      <description>&lt;P&gt;I'm trying to execute python code to start processor group and getting below error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Error:&lt;/P&gt;
&lt;PRE&gt;Traceback (most recent call last):&lt;BR /&gt;&lt;SPAN&gt;400 &lt;/SPAN&gt;Client Error: Bad Request &lt;SPAN&gt;for &lt;/SPAN&gt;url: http://localhost:&lt;SPAN&gt;8080&lt;/SPAN&gt;/nifi-api/process-groups/bee62419-&lt;SPAN&gt;016&lt;/SPAN&gt;f-&lt;SPAN&gt;1000&lt;/SPAN&gt;-f131-&lt;SPAN&gt;5&lt;/SPAN&gt;c589af8faff&lt;BR /&gt;File &lt;SPAN&gt;"/Users/xxxx/Documents/Project/BU/pythonPractice/nifiTest.py"&lt;/SPAN&gt;, line &lt;SPAN&gt;19&lt;/SPAN&gt;, &lt;SPAN&gt;in &lt;/SPAN&gt;&amp;lt;module&amp;gt;&lt;BR /&gt;r.raise_for_status()&lt;BR /&gt;File &lt;SPAN&gt;"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py"&lt;/SPAN&gt;, line &lt;SPAN&gt;940&lt;/SPAN&gt;, &lt;SPAN&gt;in &lt;/SPAN&gt;raise_for_status&lt;BR /&gt;&lt;SPAN&gt;raise &lt;/SPAN&gt;HTTPError(http_error_msg, &lt;SPAN&gt;response&lt;/SPAN&gt;=self)&lt;BR /&gt;requests.exceptions.HTTPError: &lt;SPAN&gt;400 &lt;/SPAN&gt;Client Error: Bad Request &lt;SPAN&gt;for &lt;/SPAN&gt;url: http://localhost:&lt;SPAN&gt;8080&lt;/SPAN&gt;/nifi-api/process-groups/bee62419-&lt;SPAN&gt;016&lt;/SPAN&gt;f-&lt;SPAN&gt;1000&lt;/SPAN&gt;-f131-&lt;SPAN&gt;5&lt;/SPAN&gt;c589af8faff&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;PRE&gt;newUrl=&lt;SPAN&gt;"http://localhost:8080/nifi-api/process-groups/bee62419-016f-1000-f131-5c589af8faff"&lt;BR /&gt;&lt;/SPAN&gt;data1={&lt;SPAN&gt;'id'&lt;/SPAN&gt;:&lt;SPAN&gt;'bee62419-016f-1000-f131-5c589af8faff'&lt;/SPAN&gt;,&lt;SPAN&gt;'state'&lt;/SPAN&gt;:&lt;SPAN&gt;'RUNNING'&lt;/SPAN&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;try&lt;/SPAN&gt;:&lt;BR /&gt;    r = requests.put(newUrl, &lt;SPAN&gt;data&lt;/SPAN&gt;=data1,&lt;SPAN&gt;headers&lt;/SPAN&gt;={&lt;SPAN&gt;'Content-Type'&lt;/SPAN&gt;: &lt;SPAN&gt;'application/json'&lt;/SPAN&gt;,&lt;SPAN&gt;'Accept'&lt;/SPAN&gt;: &lt;SPAN&gt;'application/json'&lt;/SPAN&gt;,&lt;SPAN&gt;'Authorization'&lt;/SPAN&gt;: &lt;SPAN&gt;'Bearer [OAUTH2_TOKEN]'&lt;/SPAN&gt;})&lt;BR /&gt;    &lt;SPAN&gt;#r = requests.get(newUrl, data=data1, headers={'Content-Type': 'application/json', 'Accept': 'application/json',&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;                                                 # 'Accept-Charset': 'UTF-8'})&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;    r.raise_for_status()&lt;BR /&gt;&lt;SPAN&gt;except  &lt;/SPAN&gt;requests.exceptions.RequestException &lt;SPAN&gt;as &lt;/SPAN&gt;e:&lt;BR /&gt;    &lt;SPAN&gt;print&lt;/SPAN&gt;(e)&lt;BR /&gt;    &lt;SPAN&gt;raise&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When same thing I'm executing through curl command it working for me&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curl -i -X PUT -H &lt;SPAN&gt;"Content-Type: application/json" &lt;/SPAN&gt;-d &lt;SPAN&gt;'{"id":"bee62419-016f-1000-f131-5c589af8faff","state":"RUNNING"}' &lt;/SPAN&gt;http://localhost:&lt;SPAN&gt;8080&lt;/SPAN&gt;/nifi-api/flow/process-groups/bee62419-&lt;SPAN&gt;016&lt;/SPAN&gt;f-&lt;SPAN&gt;1000&lt;/SPAN&gt;-f131-&lt;SPAN&gt;5&lt;/SPAN&gt;c589af8faff&lt;BR /&gt;&lt;BR /&gt;HTTP/&lt;SPAN&gt;1.1 200 &lt;/SPAN&gt;OK&lt;BR /&gt;&lt;BR /&gt;Date: Mon, &lt;SPAN&gt;20 &lt;/SPAN&gt;Jan &lt;SPAN&gt;2020 16&lt;/SPAN&gt;:&lt;SPAN&gt;38&lt;/SPAN&gt;:&lt;SPAN&gt;34 &lt;/SPAN&gt;GMT&lt;BR /&gt;&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;&lt;BR /&gt;Content-Security-Policy: frame-ancestors &lt;SPAN&gt;'self'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;X-XSS-Protection: &lt;SPAN&gt;1&lt;/SPAN&gt;; mode=block&lt;BR /&gt;&lt;BR /&gt;Cache-Control: private, no-cache, no-store, no-transform&lt;BR /&gt;&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;&lt;BR /&gt;Vary: Accept-Encoding&lt;BR /&gt;&lt;BR /&gt;Vary: User-Agent&lt;BR /&gt;&lt;BR /&gt;Content-Length: &lt;SPAN&gt;63&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;Server: Jetty(&lt;SPAN&gt;9.4.19&lt;/SPAN&gt;.v20190610)&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Jan 2020 07:42:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288000#M213382</guid>
      <dc:creator>akhileshchand04</dc:creator>
      <dc:date>2020-01-21T07:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to start processor group through Python requests (Rest api)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288028#M213405</link>
      <description>&lt;P&gt;I found the solution myself&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;import &lt;/SPAN&gt;requests&lt;BR /&gt;&lt;BR /&gt;headers = {&lt;BR /&gt;&lt;SPAN&gt;'Content-Type'&lt;/SPAN&gt;: &lt;SPAN&gt;'application/json'&lt;/SPAN&gt;,&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;data = &lt;SPAN&gt;'{"id":"bee62419-016f-1000-f131-5c589af8faff","state":"RUNNING"}'&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;response = requests.put(&lt;SPAN&gt;'http://localhost:8080/nifi-api/flow/process-groups/bee62419-016f-1000-f131-5c589af8faff'&lt;/SPAN&gt;, &lt;SPAN&gt;headers&lt;/SPAN&gt;=headers, &lt;SPAN&gt;data&lt;/SPAN&gt;=data)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 14:02:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288028#M213405</guid>
      <dc:creator>akhileshchand04</dc:creator>
      <dc:date>2020-01-21T14:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to start processor group through Python requests (Rest api)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288032#M213409</link>
      <description>&lt;P&gt;You should be able to accept your own reply as solution marking it closed/solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing I do notice, which I HIGHLY recommend against is using "localhost"... &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 14:06:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Not-able-to-start-processor-group-through-Python-requests/m-p/288032#M213409</guid>
      <dc:creator>stevenmatison</dc:creator>
      <dc:date>2020-01-21T14:06:34Z</dc:date>
    </item>
  </channel>
</rss>

