Hi,
Quite new to code snippets.
I am trying to call a webhook (for example: "https://hook.mine.com/fsgbeugber") and transfer specific data when an order is saved.
I used regular python libraries but it failed. (getting an error of Unable to acquire lock on context 'Ordername')
The code is very simple:
from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *
import requests
import json
webhook_url = 'https://hook.mine.com/o8rvt5ei' (example)
data = { 'name': 'DevOps ,
'Channel': 'Triggered from Select' }
r = requests.post(webhook_url, data=json.dumps(data), headers={'Content-type':'application/json'})
Any ideas?
Thanks for your help!
Call a webhook from Code snippet
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Call a webhook from Code snippet
Select uses a .NET Python variant called IronPython. It does not install any of the Python import libraries when Select is installed. Instead, use .NET libraries by importing the .NET common language runtime (import clr) as in https://devforum.softprocorp.com/viewtopic.php?p=6026, https://devforum.softprocorp.com/viewtopic.php?p=5184, etc.
This behavior of communicating with external sites is beyond the original design scope of code snippets. The intended use is to manipulate orders or other Select objects. Any other use is not considered a best practice and limited, if any, help can be offered from the DevForum.
This behavior of communicating with external sites is beyond the original design scope of code snippets. The intended use is to manipulate orders or other Select objects. Any other use is not considered a best practice and limited, if any, help can be offered from the DevForum.
Bob Richards, Senior Software Developer, SoftPro