mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-12 23:01:15 +00:00
modify http client
This commit is contained in:
parent
88fcdf3d1f
commit
a02c23894c
1 changed files with 4 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ from typing import Any
|
|||
|
||||
import requests
|
||||
from loguru import logger
|
||||
from pydantic import BaseModel, Field, PrivateAttr
|
||||
from pydantic import BaseModel, Field, PrivateAttr, model_validator
|
||||
|
||||
from experiencemaker.enumeration.http_enum import HttpEnum
|
||||
|
||||
|
|
@ -24,9 +24,10 @@ class HttpClient(BaseModel):
|
|||
|
||||
_client: Any = PrivateAttr()
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
@model_validator(mode="after")
|
||||
def init_client(self):
|
||||
self._client = requests.Session() if self.keep_alive else requests
|
||||
return self
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue