Requests#

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

Bases: BaseModel

Wrapper around requests to handle auth and async.

The main purpose of this wrapper is to handle authentication (by saving headers) and enable easy async methods on the same base object.

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 verify: bool | None = True#
adelete(url: str, **kwargs: Any) AsyncGenerator[ClientResponse, None][source]#

DELETE the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

AsyncGenerator[ClientResponse, None]

aget(url: str, **kwargs: Any) AsyncGenerator[ClientResponse, None][source]#

GET the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

AsyncGenerator[ClientResponse, None]

apatch(url: str, data: Dict[str, Any], **kwargs: Any) AsyncGenerator[ClientResponse, None][source]#

PATCH the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

AsyncGenerator[ClientResponse, None]

apost(url: str, data: Dict[str, Any], **kwargs: Any) AsyncGenerator[ClientResponse, None][source]#

POST to the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

AsyncGenerator[ClientResponse, None]

aput(url: str, data: Dict[str, Any], **kwargs: Any) AsyncGenerator[ClientResponse, None][source]#

PUT the URL and return the text asynchronously.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

AsyncGenerator[ClientResponse, None]

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

DELETE the URL and return the text.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

Response

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

GET the URL and return the text.

Parameters:
  • url (str) –

  • kwargs (Any) –

Return type:

Response

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

PATCH the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

Response

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

POST to the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

Response

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

PUT the URL and return the text.

Parameters:
  • url (str) –

  • data (Dict[str, Any]) –

  • kwargs (Any) –

Return type:

Response

Examples using Requests