URL Data Fetcher
Bases: DataFetcherStrategy
Fetch data from a URL.
This fetcher is used to fetch data from a URL.
Supported formats
CSV
XLSX
XLS
XML
__init__(url, file_format='csv', timeout=0, cache_strategy=None)
Initialize the URLDataFetcher.
PARAMETER | DESCRIPTION |
---|---|
url |
The URL to fetch data from.
TYPE:
|
file_format |
The format of the file.
TYPE:
|
timeout |
The timeout for the request in seconds.
TYPE:
|
cache_strategy |
The cache strategy to use. If not provided, the configured cache strategy will be used.
TYPE:
|
fetch_data()
Fetch data from the URL.
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
pd.DataFrame: Data fetched from the URL |
make_cache_key()
Generate a cache key for the URL data fetcher.
Uses the URL as the part of a cache key.
RETURNS | DESCRIPTION |
---|---|
str
|
The cache key
TYPE:
|
make_request()
Make a request to the URL and return the response content.
RETURNS | DESCRIPTION |
---|---|
bytes
|
The response content
TYPE:
|
RAISES | DESCRIPTION |
---|---|
DataFetchError
|
If an error occurs during the request |