DataRequestSearch

DataRequestSearch#

class eodag.plugins.search.data_request_search.DataRequestSearch(provider, config)[source]#

Plugin to execute search requests composed of several steps:

  1. do a data request which defines which data shall be searched

  2. check the status of the request job

  3. if finished - fetch the result of the job

Parameters:
  • provider (str) – provider name

  • config (PluginConfig) –

    Search plugin configuration:

    • api_endpoint (str) (mandatory): The endpoint of the provider’s search interface

    • results_entry (str) (mandatory): The name of the key in the provider search result that gives access to the result entries

    • data_request_url (str) (mandatory): url to which the data request shall be sent

    • status_url (str) (mandatory): url to fetch the status of the data request

    • result_url (str) (mandatory): url to fetch the search result when the data request is done

    • need_auth (bool): if authentication is needed for the search request; default: False

    • auth_error_code (int): which error code is returned in case of an authentication error; only used if need_auth=true

    • ssl_verify (bool): if the ssl certificates should be verified in requests; default: True

    • timeout (int): time to wait until request timeout in seconds; default: 5

    • dates_required (bool): if date parameters are mandatory in the request; default: True

    • pagination (Pagination) (mandatory): The configuration of how the pagination is done on the provider. It is a tree with the following nodes:

      • total_items_nb_key_path (str): An XPath or JsonPath leading to the total number of results satisfying a request. This is used for providers which provides the total results metadata along with the result of the query and don’t have an endpoint for querying the number of items satisfying a request, or for providers for which the count endpoint returns a json or xml document

      • max_items_per_page (int): The maximum number of items per page that the provider can handle; default: 50

      • start_page (int): number of the first page; default: 1

    • discover_product_types (DiscoverProductTypes): configuration for product type discovery based on information from the provider; It contains the keys:

    • constraints_file_url (str): url to fetch the constraints for a specific product type, can be an http url or a path to a file; the constraints are used to build queryables

    • constraints_entry (str): key in the json result where the constraints can be found; if not given, it is assumed that the constraints are on top level of the result, i.e. the result is an array of constraints

    • metadata_mapping (Dict[str, Any]): The search plugins of this kind can detect when a metadata mapping is “query-able”, and get the semantics of how to format the query string parameter that enables to make a query on the corresponding metadata. To make a metadata query-able, just configure it in the metadata mapping to be a list of 2 items, the first one being the specification of the query string search formatting. The later is a string following the specification of Python string formatting, with a special behaviour added to it. For example, an entry in the metadata mapping of this kind:

      completionTimeFromAscendingNode:
          - 'f=acquisition.endViewingDate:lte:{completionTimeFromAscendingNode#timestamp}'
          - '$.properties.acquisition.endViewingDate'
      

      means that the search url will have a query string parameter named f with a value of acquisition.endViewingDate:lte:1543922280.0 if the search was done with the value of completionTimeFromAscendingNode being 2018-12-04T12:18:00. What happened is that {completionTimeFromAscendingNode#timestamp} was replaced with the timestamp of the value of completionTimeFromAscendingNode. This example shows all there is to know about the semantics of the query string formatting introduced by this plugin: any eodag search parameter can be referenced in the query string with an additional optional conversion function that is separated from it by a # (see format_metadata() for further details on the available converters). Note that for the values in the free_text_search_operations configuration parameter follow the same rule. If the metadata_mapping is not a list but only a string, this means that the parameters is not queryable but it is included in the result obtained from the provider. The string indicates how the provider result should be mapped to the eodag parameter.

__init__(provider, config)[source]#
Parameters:

Methods

__init__(provider, config)

build_sort_by(sort_by_arg)

Build the sorting part of the query string or body by transforming the sort_by argument into a provider-specific string or dictionary

clear()

Clear search context

discover_product_types(**kwargs)

Fetch product types is disabled for DataRequestSearch

discover_queryables(**kwargs)

Fetch queryables list from provider using discover_queryables conf

get_metadata_mapping([product_type])

Get the plugin metadata mapping configuration (product type specific if exists)

get_product_type_cfg_value(key[, default])

Get the value of a configuration option specific to the current product type.

get_product_type_def_params(product_type, ...)

Get the provider product type definition parameters and specific settings

get_sort_by_arg(kwargs)

Extract the sort_by argument from the kwargs or the provider default sort configuration

list_queryables(filters[, product_type])

Get queryables

map_product_type(product_type, **kwargs)

Get the provider product type from eodag product type

query([prep])

performs the search for a provider where several steps are required to fetch the data

Attributes

plugins

data_request_id

auth

next_page_url

next_page_query_obj

total_items_nb

need_count