langchain.utilities.requests.TextRequestsWrapper¶

class langchain.utilities.requests.TextRequestsWrapper(*, headers: Optional[Dict[str, str]] = None, aiosession: Optional[ClientSession] = None, auth: Optional[Any] = None)[source]¶

Bases: BaseModel

Lightweight wrapper around requests library.

The main purpose of this wrapper is to always return a text output.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param aiosession: Optional[aiohttp.client.ClientSession] = None¶
param auth: Optional[Any] = None¶
param headers: Optional[Dict[str, str]] = None¶
async adelete(url: str, **kwargs: Any) str[source]¶

DELETE the URL and return the text asynchronously.

async aget(url: str, **kwargs: Any) str[source]¶

GET the URL and return the text asynchronously.

async apatch(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

PATCH the URL and return the text asynchronously.

async apost(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

POST to the URL and return the text asynchronously.

async aput(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

PUT the URL and return the text asynchronously.

delete(url: str, **kwargs: Any) str[source]¶

DELETE the URL and return the text.

get(url: str, **kwargs: Any) str[source]¶

GET the URL and return the text.

patch(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

PATCH the URL and return the text.

post(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

POST to the URL and return the text.

put(url: str, data: Dict[str, Any], **kwargs: Any) str[source]¶

PUT the URL and return the text.

property requests: langchain.utilities.requests.Requests¶
model Config[source]¶

Bases: object

Configuration for this pydantic object.

arbitrary_types_allowed = True¶
extra = 'forbid'¶

Examples using TextRequestsWrapper¶