TextRequestsWrapper#

class langchain_community.utilities.requests.TextRequestsWrapper[source]#

Bases: GenericRequestsWrapper

Lightweight wrapper around requests library, with async support.

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: ClientSession | None = None#
param auth: Any | None = None#
param headers: Dict[str, str] | None = None#
param response_content_type: Literal['text', 'json'] = 'text'#
param verify: bool = True#
async adelete(url: str, **kwargs: Any) str | Dict[str, Any]#

DELETE the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

async aget(url: str, **kwargs: Any) str | Dict[str, Any]#

GET the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

async apatch(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

PATCH the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

async apost(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

POST to the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

async aput(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

PUT the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

delete(url: str, **kwargs: Any) str | Dict[str, Any]#

DELETE the URL and return the text.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

get(url: str, **kwargs: Any) str | Dict[str, Any]#

GET the URL and return the text.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

patch(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

PATCH the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

post(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

POST to the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

put(url: str, data: Dict[str, Any], **kwargs: Any) str | Dict[str, Any]#

PUT the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

str | Dict[str, Any]

property requests: Requests#

Examples using TextRequestsWrapper