Hi,
I have a python code which is trying to authenticates to my NIFI server and start a processor inside it.
Please see code below:
from flask import Flask
import nipyapi
import requests
app = Flask(__name__)
def home():
processor_id = <processorID>
start_processor_url = f"{nifi_general}/processors/{processor_id}/run-status"
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
username = "username"
password = "password"
data = { "username": username,
"password": password
}
response = requests.post(url=nifi_url, data=data,verify=False, headers=headers)
if response.status_code == 200:
# if successfully authenticated, then start the processor
start_processor = requests.put(url=start_processor_url, headers=headers)
print(start_processor.status_code)
if start_processor.status_code == 200:
return("Processor started successfully.")
else:
return(f"Starting processor failed. Status code: {start_processor.status_code}")
else:
return(f"Failed to start processor. Status code: {response.status_code}")
if __name__ == '__main__':
app.run()
However, I am unable to authenticate with the given username and password. Note: that I have not made any changes in the nifi.properties file. Does it have to be changed?
Looking fwd to your responses.