Browse Source

fix: update inner api proxies (#9174)

tags/0.9.2
Joe 1 year ago
parent
commit
1e7ef46e9c
No account linked to committer's email address
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      api/services/enterprise/base.py

+ 6
- 1
api/services/enterprise/base.py View File

base_url = os.environ.get("ENTERPRISE_API_URL", "ENTERPRISE_API_URL") base_url = os.environ.get("ENTERPRISE_API_URL", "ENTERPRISE_API_URL")
secret_key = os.environ.get("ENTERPRISE_API_SECRET_KEY", "ENTERPRISE_API_SECRET_KEY") secret_key = os.environ.get("ENTERPRISE_API_SECRET_KEY", "ENTERPRISE_API_SECRET_KEY")


proxies = {
"http": None,
"https": None,
}

@classmethod @classmethod
def send_request(cls, method, endpoint, json=None, params=None): def send_request(cls, method, endpoint, json=None, params=None):
headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key} headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key}


url = f"{cls.base_url}{endpoint}" url = f"{cls.base_url}{endpoint}"
response = requests.request(method, url, json=json, params=params, headers=headers)
response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies)


return response.json() return response.json()

Loading…
Cancel
Save