APIResource

class xbrl_filings_api.APIResource

Bases: APIObject

Base class for JSON:API resources, i.e., data objects.

Subclasses of this class may be read into a database. An instance resembles a database record.

This library assumes the API returning datetimes in UTC, if no timezone is specified (situation as of April 2024). Original datetime string is retained in attribute with "_time_str" ending paired with the "_time" ended attributes (e.g. added_time_str).

Methods

get_data_attributes([flags, filings])

Return data attributes for an APIResource.

__hash__()

Return hash of ('APIResource', cls.TYPE, self.api_id).

__repr__()

Return repr(self).

__str__()

Return str(self).

Attributes

api_id

JSON-API resource id of APIResource.

query_time

Time when the query function was called for an APIObject.

request_url

HTTP request URL for an APIObject.

TYPE: str = ''

JSON-API resource type of APIResource subclass.

api_id: str

JSON-API resource id of APIResource.

Can be used as a unique identifier among resources of the same type.

classmethod get_data_attributes(flags=None, filings=None)

Return data attributes for an APIResource.

Excludes internal and class attributes and the ones containing objects.

For Filing objects this also means excluding attributes ending _download_path if every filing in parameter filings have this attribute as None. Additionally, if GET_ENTITY is not included in parameter flags, returned attribute list will exclude entity_api_id.

Parameters:
Returns:

List of data attributes.

Return type:

list of str

__eq__(other)

Return True when both __hash__() match.

Parameters:

other (Any)

Return type:

bool

__hash__()

Return hash of ('APIResource', cls.TYPE, self.api_id).