Documentation Index
Fetch the complete documentation index at: https://mintlify.com/galloclaudio/mega-search-links/llms.txt
Use this file to discover all available pages before exploring further.
fetch_urls
Fetches URLs from the API based on the search query.Signature
Parameters
The query string for the API search.
Returns
A list of URLs retrieved from the API. Returns an empty list if an error occurs.
Behavior
The method performs the following operations:- Constructs the complete URL by appending the search query parameter
- Sends a GET request to the API with the configured headers
- Validates the HTTP response status using
raise_for_status()(raises HTTPError for 4xx and 5xx status codes) - Parses the JSON response
- Extracts URLs from the
'urls'key in the response data
Exception Handling
The method catchesrequests.exceptions.RequestException and handles errors gracefully:
- Prints an error message to the console
- Returns an empty list instead of raising an exception
Example
Error Cases
Network Errors: Anyrequests.exceptions.RequestException (including connection errors, timeouts, etc.) will be caught and handled:
response.raise_for_status() which raises an HTTPError for bad status codes (4xx and 5xx), which is then caught by the exception handler.
Empty Results: If the API response doesn’t contain a 'urls' key, the method returns an empty list using data.get('urls', []).