OiO.lk Blog python Unable to trigger Power Automate flow using python script
python

Unable to trigger Power Automate flow using python script


I am trying to send message on teams using a python script using Power Automate.

import requests  # Import requests library
import datetime

# Get current time.
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")

# Triggering Power Automate Flow
flow_url="https://***/triggers/manual/paths/invoke?api-version=2016-06-01"  # Replace with actual URL from step 2

response=requests.post(flow_url,json={"status":"Script Completed","timestamp":now})

if response.status_code==200:
     print('PowerAutomate Flow triggered successfully')
else:
     print(f'Failed to trigger PowerAutomate Flow: {response.status_code}')

Error:

Failed to trigger PowerAutomate Flow: 401

Power Automate Flow:



You need to sign in to view this answers

Exit mobile version