API Reference¶
Clients¶
esiosapy.ESIOSAPYClient
¶
A client for interacting with the ESIOS API.
This client provides access to various managers that handle specific types of requests to the ESIOS API, such as archives, indicators, and offer indicators. It simplifies the process of making requests by managing authentication and constructing the necessary URLs.
Can be used as a context manager:
with ESIOSAPYClient(token="xxx") as client:
indicators = client.indicators.list_all()
Source code in esiosapy/client.py
Functions¶
__enter__()
¶
__exit__(*args)
¶
__init__(token, base_url=ESIOS_API_URL, timeout=30)
¶
Initializes the ESIOSAPYClient with an API token and a base URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The API token used for authentication. |
required |
base_url
|
str
|
The base URL for the ESIOS API. Defaults to ESIOS_API_URL. |
ESIOS_API_URL
|
timeout
|
int
|
Request timeout in seconds, defaults to 30. |
30
|
Source code in esiosapy/client.py
close()
¶
raw_request(url, headers=None)
¶
Makes a raw GET request to a specified URL with optional headers.
This method allows for making a direct GET request to a specified URL. It adds default headers to the request and handles URL construction if the provided URL is relative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to which the GET request is made. If the URL is relative, it will be joined with the base URL. |
required |
headers
|
dict[str, str] | None
|
Optional headers to include in the request. If not provided, default headers will be added. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
requests.Response
|
The response object resulting from the GET request. |
Source code in esiosapy/client.py
esiosapy.AsyncESIOSAPYClient
¶
An async client for interacting with the ESIOS API.
This client provides access to various managers that handle specific types of requests to the ESIOS API, such as archives, indicators, and offer indicators. It uses httpx for async HTTP operations.
Requires httpx to be installed. Install with: pip install esiosapy[async]
Source code in esiosapy/async_client.py
Functions¶
__init__(token, base_url=ESIOS_API_URL, timeout=30)
¶
Initializes the AsyncESIOSAPYClient with an API token and a base URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
token
|
str
|
The API token used for authentication. |
required |
base_url
|
str
|
The base URL for the ESIOS API. Defaults to ESIOS_API_URL. |
ESIOS_API_URL
|
timeout
|
int
|
Request timeout in seconds, defaults to 30. |
30
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If httpx is not installed. |
Source code in esiosapy/async_client.py
close()
async
¶
raw_request(url, headers=None)
async
¶
Makes a raw async GET request to a specified URL with optional headers.
This method allows for making a direct GET request to a specified URL. It adds default headers to the request and handles URL construction if the provided URL is relative.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to which the GET request is made. If the URL is relative, it will be joined with the base URL. |
required |
headers
|
dict[str, str] | None
|
Optional headers to include in the request. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
httpx.Response
|
The response object resulting from the GET request. |
Source code in esiosapy/async_client.py
Managers¶
esiosapy.IndicatorManager
¶
Bases: BaseIndicatorManager[RequestHelper]
Manages indicator-related operations for the ESIOS API.
This class provides methods to retrieve and search for indicators from the ESIOS API, including listing all available indicators and searching for indicators by name.
Source code in esiosapy/managers/indicator_manager.py
Functions¶
__init__(request_helper)
¶
Initializes the IndicatorManager with a RequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
RequestHelper
|
An instance of RequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/indicator_manager.py
list_all(taxonomy_terms=None)
¶
Retrieves a list of all indicators, optionally filtered by taxonomy terms.
This method sends a GET request to the /indicators endpoint and
returns a list of Indicator objects. If taxonomy terms are provided,
they are used to filter the indicators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to filter the indicators, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Indicator]
|
A list of Indicator objects representing all (or filtered) indicators. |
Source code in esiosapy/managers/indicator_manager.py
search(name)
¶
Searches for indicators by name.
This method sends a GET request to the /indicators endpoint with a
search query, returning a list of Indicator objects that match the
specified name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name or part of the name to search for in indicators. |
required |
Returns:
| Type | Description |
|---|---|
list[Indicator]
|
A list of Indicator objects that match the search query. |
Source code in esiosapy/managers/indicator_manager.py
esiosapy.AsyncIndicatorManager
¶
Bases: BaseIndicatorManager[AsyncRequestHelper]
Manages indicator-related operations for the ESIOS API (async version).
This class provides methods to retrieve and search for indicators from the ESIOS API, including listing all available indicators and searching for indicators by name.
Source code in esiosapy/managers/async_indicator_manager.py
Functions¶
__init__(request_helper)
¶
Initializes the AsyncIndicatorManager with an AsyncRequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
AsyncRequestHelper
|
An instance of AsyncRequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/async_indicator_manager.py
list_all(taxonomy_terms=None)
async
¶
Retrieves a list of all indicators, optionally filtered by taxonomy terms.
This method sends a GET request to the /indicators endpoint and
returns a list of Indicator objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to filter the indicators, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Indicator]
|
A list of Indicator objects representing all (or filtered) indicators. |
Source code in esiosapy/managers/async_indicator_manager.py
search(name)
async
¶
Searches for indicators by name.
This method sends a GET request to the /indicators endpoint with a
search query, returning a list of Indicator objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name or part of the name to search for in indicators. |
required |
Returns:
| Type | Description |
|---|---|
list[Indicator]
|
A list of Indicator objects that match the search query. |
Source code in esiosapy/managers/async_indicator_manager.py
esiosapy.ArchiveManager
¶
Bases: BaseArchiveManager[RequestHelper]
Manages archive-related operations for the ESIOS API.
This class provides methods to retrieve and filter archives from the ESIOS API, such as listing all archives or filtering them by date or date range.
Source code in esiosapy/managers/archive_manager.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
Functions¶
__init__(request_helper)
¶
Initializes the ArchiveManager with a RequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
RequestHelper
|
An instance of RequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/archive_manager.py
list_all()
¶
Retrieves a list of all archives.
This method sends a GET request to the /archives endpoint and
returns a list of Archive objects representing all available archives.
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects representing all archives. |
Source code in esiosapy/managers/archive_manager.py
list_by_date(target_dt, date_type=None, taxonomy_terms=None)
¶
Retrieves a list of archives filtered by a specific date.
This method sends a GET request to the /archives endpoint with filters
based on the provided date, date type, and optional taxonomy terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt
|
datetime | str
|
The target date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
date_type
|
ArchiveDateType | None
|
The type of date to filter by (e.g., publication date), defaults to None. |
None
|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to further filter the archives, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects filtered by the specified date. |
Source code in esiosapy/managers/archive_manager.py
list_by_date_range(target_dt_start, target_dt_end, date_type=None, taxonomy_terms=None)
¶
Retrieves a list of archives filtered by a date range.
This method sends a GET request to the /archives endpoint with filters
based on the provided start and end dates, date type, and optional taxonomy
terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt_start
|
datetime | str
|
The start date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
target_dt_end
|
datetime | str
|
The end date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
date_type
|
ArchiveDateType | None
|
The type of date to filter by (e.g., publication date), defaults to None. |
None
|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to further filter the archives, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects filtered by the specified date range. |
Source code in esiosapy/managers/archive_manager.py
esiosapy.AsyncArchiveManager
¶
Bases: BaseArchiveManager[AsyncRequestHelper]
Manages archive-related operations for the ESIOS API (async version).
This class provides methods to retrieve archives from the ESIOS API, including listing all archives and filtering by date.
Source code in esiosapy/managers/async_archive_manager.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
Functions¶
__init__(request_helper)
¶
Initializes the AsyncArchiveManager with an AsyncRequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
AsyncRequestHelper
|
An instance of AsyncRequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/async_archive_manager.py
list_all()
async
¶
Retrieves a list of all archives.
This method sends a GET request to the /archives endpoint and
returns a list of Archive objects representing all available archives.
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects representing all archives. |
Source code in esiosapy/managers/async_archive_manager.py
list_by_date(target_dt, date_type=None, taxonomy_terms=None)
async
¶
Retrieves a list of archives filtered by a specific date.
This method sends a GET request to the /archives endpoint with filters
based on the provided date, date type, and optional taxonomy terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt
|
datetime | str
|
The target date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
date_type
|
ArchiveDateType | None
|
The type of date to filter by (e.g., publication date), defaults to None. |
None
|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to further filter the archives, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects filtered by the specified date. |
Source code in esiosapy/managers/async_archive_manager.py
list_by_date_range(target_dt_start, target_dt_end, date_type=None, taxonomy_terms=None)
async
¶
Retrieves a list of archives filtered by a date range.
This method sends a GET request to the /archives endpoint with filters
based on the provided start and end dates, date type, and optional taxonomy
terms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt_start
|
datetime | str
|
The start date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
target_dt_end
|
datetime | str
|
The end date for filtering archives. Can be a datetime object or an ISO 8601 formatted string. |
required |
date_type
|
ArchiveDateType | None
|
The type of date to filter by (e.g., publication date), defaults to None. |
None
|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to further filter the archives, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[Archive]
|
A list of Archive objects filtered by the specified date range. |
Source code in esiosapy/managers/async_archive_manager.py
esiosapy.OfferIndicatorManager
¶
Bases: BaseOfferIndicatorManager[RequestHelper]
Manages offer indicator-related operations for the ESIOS API.
This class provides methods to retrieve offer indicators from the ESIOS API, including listing all available offer indicators with optional filtering by taxonomy terms.
Source code in esiosapy/managers/offer_indicator_manager.py
Functions¶
__init__(request_helper)
¶
Initializes the OfferIndicatorManager with a RequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
RequestHelper
|
An instance of RequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/offer_indicator_manager.py
list_all(taxonomy_terms=None)
¶
Retrieves a list of all offer indicators, optionally filtered by taxonomy terms.
This method sends a GET request to the /offer_indicators endpoint and
returns a list of OfferIndicator objects. If taxonomy terms are provided,
they are used to filter the offer indicators.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to filter the offer indicators, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[OfferIndicator]
|
A list of OfferIndicator objects representing all (or filtered) offer indicators. |
Source code in esiosapy/managers/offer_indicator_manager.py
esiosapy.AsyncOfferIndicatorManager
¶
Bases: BaseOfferIndicatorManager[AsyncRequestHelper]
Manages offer indicator-related operations for the ESIOS API (async version).
This class provides methods to retrieve offer indicators from the ESIOS API, including listing all available offer indicators with optional filtering by taxonomy terms.
Source code in esiosapy/managers/async_offer_indicator_manager.py
Functions¶
__init__(request_helper)
¶
Initializes the AsyncOfferIndicatorManager with an AsyncRequestHelper.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request_helper
|
AsyncRequestHelper
|
An instance of AsyncRequestHelper used to make API requests. |
required |
Source code in esiosapy/managers/async_offer_indicator_manager.py
list_all(taxonomy_terms=None)
async
¶
Retrieves a list of all offer indicators, optionally filtered by taxonomy terms.
This method sends a GET request to the /offer_indicators endpoint and
returns a list of OfferIndicator objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
taxonomy_terms
|
list[str] | None
|
A list of taxonomy terms to filter the offer indicators, defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
list[OfferIndicator]
|
A list of OfferIndicator objects representing all (or filtered) offer indicators. |
Source code in esiosapy/managers/async_offer_indicator_manager.py
Exceptions¶
esiosapy.exceptions.ESIOSAPIError
¶
Bases: Exception
Base exception for all ESIOS API errors.
Source code in esiosapy/exceptions.py
esiosapy.exceptions.APIResponseError
¶
Bases: ESIOSAPIError
Raised when the API returns an error response.
Source code in esiosapy/exceptions.py
esiosapy.exceptions.AuthenticationError
¶
Bases: ESIOSAPIError
Raised when authentication fails (invalid or missing API token).
Source code in esiosapy/exceptions.py
Constants¶
esiosapy.constants.ESIOS_API_URL = 'https://api.esios.ree.es/'
module-attribute
¶
Models¶
esiosapy.models.Indicator
¶
Bases: BaseModel
Represents an indicator with associated metadata and methods to retrieve and process its data.
This class models an indicator object, which includes various attributes such as its ID, name, description, and raw data. It also provides methods to prettify the description and to fetch the indicator's data over specified date ranges with optional geographical and time-based aggregations and truncations.
Source code in esiosapy/models/indicator/indicator.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
Attributes¶
description = 'No description available.'
class-attribute
instance-attribute
¶
A detailed description of the indicator.
id
instance-attribute
¶
The unique identifier for the indicator.
name
instance-attribute
¶
The name of the indicator.
raw
instance-attribute
¶
The raw dictionary containing the original data of the indicator.
short_name
instance-attribute
¶
The short name of the indicator.
Functions¶
__init__(**data)
¶
Initializes the Indicator class with the provided data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data used to initialize the indicator, including the request helper and other attributes. |
{}
|
Source code in esiosapy/models/indicator/indicator.py
get_data(target_dt_start, target_dt_end, geo_ids=None, geo_agg=None, geo_trunc=None, time_agg=None, time_trunc=None, all_raw_data=False)
¶
Retrieves the data for the indicator based on the specified parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt_start
|
datetime | str
|
The start date and time for data retrieval. |
required |
target_dt_end
|
datetime | str
|
The end date and time for data retrieval. |
required |
geo_ids
|
list[str] | None
|
A list of geographical identifiers to filter data, defaults to None. |
None
|
geo_agg
|
GeoAgg | None
|
The geographical aggregation method, defaults to None. |
None
|
geo_trunc
|
GeoTrunc | None
|
The geographical truncation level, defaults to None. |
None
|
time_agg
|
TimeAgg | None
|
The time aggregation method, defaults to None. |
None
|
time_trunc
|
TimeTrunc | None
|
The time truncation level, defaults to None. |
None
|
all_raw_data
|
bool
|
Whether to return all raw data or just the indicator values, defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
The retrieved indicator data, either as raw JSON or processed values. |
Source code in esiosapy/models/indicator/indicator.py
prettify_description()
¶
Converts the HTML description of the indicator into a plain text format with better readability.
Returns:
| Type | Description |
|---|---|
str
|
The prettified description as a plain text string. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If |
Source code in esiosapy/models/indicator/indicator.py
esiosapy.models.Archive
¶
Bases: BaseModel
Represents an archive with metadata and methods to download associated files.
This class models an archive object with various attributes such as its ID, name, type, and associated download information. It also provides a method to download the archive file, with options to unzip the file and remove the original zip file.
Source code in esiosapy/models/archive/archive.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
Attributes¶
archive_type
instance-attribute
¶
The type/category of the archive.
date_times = Field(default_factory=list)
class-attribute
instance-attribute
¶
A list of dates associated with the archive.
download
instance-attribute
¶
The download information associated with the archive.
horizon
instance-attribute
¶
The horizon associated with the archive.
id
instance-attribute
¶
The unique identifier for the archive.
name
instance-attribute
¶
The name of the archive.
publication_date = Field(default_factory=list)
class-attribute
instance-attribute
¶
A list of publication dates for the archive.
raw
instance-attribute
¶
The raw data from which the archive object was created.
taxonomy_terms = Field(default_factory=list)
class-attribute
instance-attribute
¶
A list of taxonomy terms associated with the archive.
vocabularies = Field(default_factory=list)
class-attribute
instance-attribute
¶
A list of vocabularies associated with the archive.
Functions¶
__init__(**data)
¶
Initializes the Archive object with the provided data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
The data used to initialize the Archive object. This includes all the attributes as well as a RequestHelper instance for making API requests. |
{}
|
Source code in esiosapy/models/archive/archive.py
download_file(path=None, unzip=True, remove_zip=True)
¶
Downloads the archive file and optionally unzips it.
This method downloads the file associated with the archive to the specified path. The file can be automatically unzipped and the original zip file can be removed based on the provided options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path | None
|
The directory where the file should be downloaded. If not provided, the current working directory is used. |
None
|
unzip
|
bool
|
Whether to unzip the downloaded file, defaults to True. |
True
|
remove_zip
|
bool
|
Whether to remove the original zip file after unzipping, defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in esiosapy/models/archive/archive.py
esiosapy.models.OfferIndicator
¶
Bases: BaseModel
Source code in esiosapy/models/offer_indicator/offer_indicator.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
Attributes¶
description
instance-attribute
¶
A detailed description of the offer indicator, often in HTML format.
id
instance-attribute
¶
The unique identifier of the offer indicator.
name
instance-attribute
¶
The name of the offer indicator.
raw
instance-attribute
¶
Raw data associated with the offer indicator.
Functions¶
__init__(**data)
¶
Initialize the OfferIndicator instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Arbitrary keyword arguments that initialize the object. |
{}
|
Source code in esiosapy/models/offer_indicator/offer_indicator.py
get_data_by_date(target_dt, all_raw_data=False)
¶
Retrieve the indicator data for a specific date.
This method fetches the indicator data for a given date, either returning the raw JSON response or the specific indicator values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt
|
datetime | str
|
The target date for which to retrieve data, either as a datetime object or a string. |
required |
all_raw_data
|
bool
|
If True, returns the entire raw JSON response; otherwise, only returns the indicator values. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
The requested data, either as a raw JSON or as specific indicator values. |
Source code in esiosapy/models/offer_indicator/offer_indicator.py
get_data_by_date_range(target_dt_start, target_dt_end, all_raw_data=False)
¶
Retrieve the indicator data for a specific date range.
This method fetches the indicator data for a given date range, either returning the raw JSON response or the specific indicator values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_dt_start
|
datetime | str
|
The start date for the range, either as a datetime object or a string. |
required |
target_dt_end
|
datetime | str
|
The end date for the range, either as a datetime object or a string. |
required |
all_raw_data
|
bool
|
If True, returns the entire raw JSON response; otherwise, only returns the indicator values. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
The requested data, either as a raw JSON or as specific indicator values. |
Source code in esiosapy/models/offer_indicator/offer_indicator.py
prettify_description()
¶
Convert the HTML description into a prettified plain-text format.
This method uses BeautifulSoup to parse and clean the HTML content found in the description, returning it as a plain-text string.
Returns:
| Type | Description |
|---|---|
str
|
A prettified plain-text version of the description. |
Raises:
| Type | Description |
|---|---|
ImportError
|
If the BeautifulSoup package is not installed. |