Data streams
Implementation of a resource container for the data streams endpoint.
DataStreams(resources)
¶
Bases: ResourceContainer
Implementation of the resource container for the data stream endpoint.
This resource container is a collection of data streams returned by the StreamPipes API.
It is capable of parsing the response content directly into a list of queried DataStream
.
Furthermore, the resource container makes them accessible in a pythonic manner.
from_json(json_string)
classmethod
¶
Creates a ResourceContainer
from the given JSON string.
PARAMETER | DESCRIPTION |
---|---|
json_string |
The JSON string returned from the StreamPipes API.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
container
|
Instance of the container derived from the JSON definition
TYPE:
|
RAISES | DESCRIPTION |
---|---|
StreamPipesDataModelError
|
If a resource cannot be mapped to the corresponding Python data model. |
StreamPipesResourceContainerJSONError
|
If JSON response cannot be parsed to a |
to_dicts(use_source_names=False)
¶
Returns the contained resources as list of dictionaries.
PARAMETER | DESCRIPTION |
---|---|
use_source_names |
Determines whether the field names are named in Python style (=
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
dictionary_list
|
List of resources in dictionary representation.
If
TYPE:
|
to_json()
¶
Returns the resource container in the StreamPipes JSON representation.
RETURNS | DESCRIPTION |
---|---|
json_string: str
|
JSON representation of the resource container where key names are equal to keys used in the StreamPipes backend |
to_pandas()
¶
Returns the resource container in representation of a Pandas Dataframe.
RETURNS | DESCRIPTION |
---|---|
resource_container_df
|
Representation of the resource container as pandas DataFrame
TYPE:
|