Repository navigation
API Reference
GitHub Action edited this page Mar 15, 2026
·
1 revision
The application's primary interaction with external services is its URL fetching capability, utilized when a user provides a URL instead of raw HTML content. This interaction is managed by the requests library within the app.py module.
The target endpoint is any valid URL string provided by the user in a source block configured for "URL Link" mode. The application initiates a GET request to this user-specified URL.
-
Method:
GET -
Headers:
-
User-Agent:Mozilla/5.0(sent to mimic a common web browser)
-
- Timeout: A maximum of 10 seconds is allowed for the request to complete. Requests that exceed this duration will time out.
-
Payload: No request body is sent for these
GEToperations.
Upon a successful GET request (indicated by an HTTP status code of 200), the expected response format is the raw HTML content of the target webpage, returned as a string.
The _fetch_url function in app.py implements error handling for external HTTP requests:
-
Network/Connection Issues: Any
requests.exceptions.RequestException(e.g., connection errors, DNS resolution failures, timeouts) will result inNonebeing returned for the fetched content. The specific exception message is captured and returned as an error string. -
HTTP Status Codes: If the HTTP response status code is anything other than
200 OK, the fetched content will beNone, and an error message (e.g.,HTTP 404,HTTP 500) will be provided. -
UI Feedback: In the event of a fetch failure, the application's user interface displays a localized error message (e.g.,
t["url_error"]or "Error fetching URL") for the affected source block, indicating that the URL could not be retrieved.