Skip to content

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: str

file_format

The format of the file.

TYPE: str DEFAULT: 'csv'

timeout

The timeout for the request in seconds.

TYPE: int DEFAULT: 0

cache_strategy

The cache strategy to use. If not provided, the configured cache strategy will be used.

TYPE: str DEFAULT: None

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: str

make_request()

Make a request to the URL and return the response content.

RETURNS DESCRIPTION
bytes

The response content

TYPE: bytes

RAISES DESCRIPTION
DataFetchError

If an error occurs during the request