mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-03-18 19:12:07 +00:00
feat: add request_jdmc method
This commit is contained in:
13
apps/common/jdmc.py
Normal file
13
apps/common/jdmc.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.conf import settings
|
||||
|
||||
import requests_unixsocket
|
||||
|
||||
__all__ = ['request_jdmc']
|
||||
|
||||
|
||||
def request_jdmc(method='GET', path='', timeout=(5, 60)):
|
||||
''' path: JDMC API path, e.g. /jdmc/api/v1/apps/license '''
|
||||
url = settings.JDMC_BASE_URL + path
|
||||
with requests_unixsocket.Session() as session:
|
||||
response = session.request(method, url, timeout=timeout)
|
||||
return response
|
||||
Reference in New Issue
Block a user