DRB OData CSC implementation
Project description
OData CSC implementation
This drb-impl-odata module implements the OData protocol access following the Copernicus Space Component schema (CSC) with DRB data model. It is able to navigate among Product entities of a OData CSC service.
Nodes
ODataServiceNode
Represents the OData CSC service. This node has no attribute and
has as children Product entities of the service defined by
ProductNode
.
A specific ProductNode
can be retrieved during the bracket and
slash navigation by his Name(str) or by his Id(UUID).
CSC OData services required can be access using the second (optional) parameter auth of ODataServiceNode, this parameter must be an requests.auth.AuthBase object, see requests documentation for more details.
ODataProductNode
Represents a Product entity of the OData CSC service. This
node has as attribute properties of the associated entity and has
for unique child a ProductAttributeNode
ODataProductAttributeNode
This node allowing to represent the navigation link between the
Product entity and its attributes. It has no attribute and has as
children Attribute entities associated to the Product entity,
defined by AttributeNode
ODataAttributeNode
Represents an Attribute entity. This node has no child and has as attribute properties associated to the Attribute entity.
Predicate
ODataCustomQuery
This predicate allows to retrieve a specific subset of children of an ODataServiceNode.
Installation
pip install drb-impl-odata
Examples
from uuid import UUID
from requests.auth import HTTPBasicAuth
from drb_impl_odata import ODataServiceNode, ODataProductNode,
ODataAttributeNode, ODataQueryPredicate
# generate ODataServiceNode without authentication
odata = ODataServiceNode('https://my.csc.odata.com')
# generate ODataServiceNode with authentication mechanism
odata = ODataServiceNode('https://my.csc.odata.com',
auth=HTTPBasicAuth('usr', 'pwd'))
# total number of children
product_count = len(odata)
# retrieve first ODataProductNode
node_idx = odata[0]
# retrieve last ODataProductNode
node_idx = odata[-1]
# retrieve 10 first products
products = odata.children[:10]
# retrieve Product by name
name = 'S2B_OPER_MSI_L0__GR_EPAE_..._D05_N02.06.tar'
node_name_list = odata[name] # returns a list
node_name = odata[name, 1] # returns first occurrence of the list
# retrieve Product by UUID
uuid = UUID('0723d9bf-02a2-3e99-b1b3-f6d81de84b62')
node_uuid = odata[uuid]
# get product attributes
prd_node = odata[uuid]
attr_node = prd_node['Attributes', 1]['Footprint', 1]
attr_type = attr_node.get_attribute('ValueType')
attr_value = attr_node.value
# filter and order products
filtered_children = odata / ODataQueryPredicate(filter="startswith(Name,'S1')",
order="ContentLength desc")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for drb_impl_odata-1.0b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 674c32f5ea9465701a7d54e7c3d5b5b430f2995d8e884dbf199a9e819557d334 |
|
MD5 | 7308abdfee425e84de7a54338d127efa |
|
BLAKE2b-256 | b5acf1b318ddd6902b04a04b9ec8c9600cae850756b2f95f3ea0b38a9d042dab |