I am trying to send a process-completion message to an external webhook using the following code:
def send_results_to_callback(order_id, url, result):
try:
payload = {
'process_id': IMAGEGEN_ID,
'order_id': order_id,
'status': result['ok'],
'reponse': result['response']
}
headers = {
'Content-Type': 'application/json',
'Authorization': f"Basic {IMAGEGEN_USER_PW_CREDS}",
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36',
'Cache-Control': 'no-cache',
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br'
}
resp = requests.post(url, json=payload, headers=headers, timeout=60)
resp.raise_for_status()
I am getting a timeout exception when I run this on pythonanywhere. This code runs on my laptop and the same post also works in Postman.
I have tried various header parameters including leaving the 'User-Agent' out.
I have also determined that the webhook server is not receiving the post.
Any suggestions?
Thanks in advance,
John Underwood
[edit by admin: formatting]