forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
421 B
Python
16 lines
421 B
Python
"""Lightweight wrapper around request library."""
|
|
from typing import Optional
|
|
|
|
import requests
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class RequestsWrapper(BaseModel):
|
|
"""Lightweight wrapper to partial out everything except the url to hit."""
|
|
|
|
headers: Optional[dict] = None
|
|
|
|
def run(self, url: str) -> str:
|
|
"""Hit the URL and return the text."""
|
|
return requests.get(url, headers=self.headers).text
|