|
| 1 | +""" |
| 2 | +browserbase integration module |
| 3 | +""" |
| 4 | +from browserbase import Browserbase |
| 5 | + |
| 6 | +def browser_base_fetch(api_key: str, project_id: str, link: str) -> object: |
| 7 | + """ |
| 8 | + BrowserBase Fetch |
| 9 | + This module provides an interface to the BrowserBase API. |
| 10 | + The `browser_base_fetch` function takes three arguments: |
| 11 | + - `api_key`: The API key provided by BrowserBase. |
| 12 | + - `project_id`: The ID of the project on BrowserBase where you want to fetch data from. |
| 13 | + - `link`: The URL or link that you want to fetch data from. |
| 14 | + It initializes a Browserbase object with the given API key and project ID, |
| 15 | + then uses this object to load the specified link. |
| 16 | + It returns the result of the loading operation. |
| 17 | + Example usage: |
| 18 | + ``` |
| 19 | + from browser_base_fetch import browser_base_fetch |
| 20 | + result = browser_base_fetch(api_key="your_api_key", |
| 21 | + project_id="your_project_id", link="https://example.com") |
| 22 | + print(result) |
| 23 | + ``` |
| 24 | + Please note that you need to replace "your_api_key" and "your_project_id" |
| 25 | + with your actual BrowserBase API key and project ID. |
| 26 | + Args: |
| 27 | + api_key (str): The API key provided by BrowserBase. |
| 28 | + project_id (str): The ID of the project on BrowserBase where you want to fetch data from. |
| 29 | + link (str): The URL or link that you want to fetch data from. |
| 30 | + Returns: |
| 31 | + object: The result of the loading operation. |
| 32 | + """ |
| 33 | + |
| 34 | + browserbase = Browserbase(api_key=api_key, project_id=project_id) |
| 35 | + |
| 36 | + result = browserbase.load(link) |
| 37 | + |
| 38 | + return result |
0 commit comments