Explorar el Código

add https proxy for Tencent nlp service

highing666 hace 4 años
padre
commit
8b23bd74de
Se han modificado 3 ficheros con 3 adiciones y 2 borrados
  1. 0 1
      app/controllers/nlp/meeting.py
  2. 2 0
      app/core/config.py
  3. 1 1
      app/services/tencent_nlp.py

+ 0 - 1
app/controllers/nlp/meeting.py

@@ -34,7 +34,6 @@ class MeetingInfoCatcher:
                 index = token.Id
                 for item in dp_tokens:
                     if item.HeadId == index:
-                        logger.debug(item)
                         if await self.nlp_service.get_word_similarity(item.Word, '小') > 0.9:
                             size = 'small'
                         if await self.nlp_service.get_word_similarity(item.Word, '中') > 0.9:

+ 2 - 0
app/core/config.py

@@ -14,6 +14,8 @@ class Settings(BaseSettings):
     TRANSFER_HOST: AnyHttpUrl
     WEATHER_HOST: AnyHttpUrl
 
+    HTTPS_PROXY: AnyHttpUrl
+
     TENCENT_NLP_ENDPOINT: str
     TENCENT_SECRET_ID_V1: str
     TENCENT_SECRET_KEY_V1: str

+ 1 - 1
app/services/tencent_nlp.py

@@ -32,7 +32,7 @@ class TencentNLP:
 
     def __init__(self):
         cred = credential.Credential(settings.TENCENT_SECRET_ID_V1, settings.TENCENT_SECRET_KEY_V1)
-        http_profile = HttpProfile()
+        http_profile = HttpProfile(proxy=settings.HTTPS_PROXY)
         http_profile.reqMethod = 'GET'
         http_profile.endpoint = settings.TENCENT_NLP_ENDPOINT