How can i use curl api in erpnext
Use requests
instead.
But i need to use curl api
requests
has more than what cURL
has to offer. You’re assuming that cURL
exists (They’re not shipped by default on many OSes). Nevertheless,
Spawn the cURL
process then.
>>> import os
>>> os.system('curl https://httpbin.org')
Or capture the input using subprocess.Popen
?
>>> import subprocess
>>> subprocess.Popen(['curl', '-fsSL', 'https://httpbin.org/ip'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
requests
alternative
>>> import requests
>>> r = requests.get('https://httpbin.org/ip')
>>> r.json()
Comes shipped with ERPNext!
2 Likes