nodes: 0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_default_parameter; 8, typed_default_parameter; 9, typed_default_parameter; 10, typed_default_parameter; 11, typed_default_parameter; 12, typed_default_parameter; 13, typed_default_parameter; 14, typed_default_parameter; 15, typed_default_parameter; 16, typed_default_parameter; 17, typed_default_parameter; 18, typed_default_parameter; 19, typed_default_parameter; 20, typed_default_parameter; 21, typed_default_parameter; 22, typed_default_parameter; 23, typed_default_parameter; 24, identifier:dict; 25, expression_statement; 26, comment:# specific resources specific parsing; 27, expression_statement; 28, comment:# sub resources specific parsing; 29, expression_statement; 30, comment:# handling request parameters; 31, expression_statement; 32, if_statement; 33, comment:# search request; 34, expression_statement; 35, try_statement; 36, comment:# fast response check; 37, expression_statement; 38, comment:# serializing result into dict and storing resources in variables; 39, expression_statement; 40, expression_statement; 41, comment:# total of metadatas shared; 42, comment:# handling Isogeo API pagination; 43, comment:# see: http://help.isogeo.com/api/fr/methods/pagination.html; 44, if_statement; 45, comment:# add shares to tags and query; 46, if_statement; 47, comment:# store tags in dicts; 48, if_statement; 49, comment:# end of method; 50, return_statement; 51, identifier:token; 52, type; 53, None; 54, identifier:query; 55, type; 56, string:""; 57, identifier:bbox; 58, type; 59, None; 60, identifier:poly; 61, type; 62, None; 63, identifier:georel; 64, type; 65, None; 66, identifier:order_by; 67, type; 68, string:"_created"; 69, identifier:order_dir; 70, type; 71, string:"desc"; 72, identifier:page_size; 73, type; 74, integer:100; 75, identifier:offset; 76, type; 77, integer:0; 78, identifier:share; 79, type; 80, None; 81, identifier:specific_md; 82, type; 83, list; 84, identifier:include; 85, type; 86, list; 87, identifier:whole_share; 88, type; 89, True; 90, identifier:check; 91, type; 92, True; 93, identifier:augment; 94, type; 95, False; 96, identifier:tags_as_dicts; 97, type; 98, False; 99, identifier:prot; 100, type; 101, string:"https"; 102, comment:"""Search within the resources shared to the application.
  
          It's the main method to use.
  
          :param str token: API auth token - DEPRECATED: token is now automatically included
          :param str query: search terms and semantic filters. Equivalent of
           **q** parameter in Isogeo API. It could be a simple
           string like *oil* or a tag like *keyword:isogeo:formations*
           or *keyword:inspire-theme:landcover*. The *AND* operator
           is applied when various tags are passed.
          :param list bbox: Bounding box to limit the search.
           Must be a 4 list of coordinates in WGS84 (EPSG 4326).
           Could be associated with *georel*.
          :param str poly: Geographic criteria for the search, in WKT format.
           Could be associated with *georel*.
          :param str georel: geometric operator to apply to the bbox or poly
           parameters.
  
           Available values (see: *isogeo.GEORELATIONS*):
  
            * 'contains',
            * 'disjoint',
            * 'equals',
            * 'intersects' - [APPLIED BY API if NOT SPECIFIED]
            * 'overlaps',
            * 'within'.
  
          :param str order_by: sorting results.
  
           Available values:
  
            * '_created': metadata creation date [DEFAULT if relevance is null]
            * '_modified': metadata last update
            * 'title': metadata title
            * 'created': data creation date (possibly None)
            * 'modified': data last update date
            * 'relevance': relevance score calculated by API [DEFAULT].
  
          :param str order_dir: sorting direction.
  
           Available values:
            * 'desc': descending
            * 'asc': ascending
  
          :param int page_size: limits the number of results.
           Useful to paginate results display. Default value: 100.
          :param int offset: offset to start page size
           from a specific results index
          :param str share: share UUID to filter on
          :param list specific_md: list of metadata UUIDs to filter on
          :param list include: subresources that should be returned.
           Must be a list of strings. Available values: *isogeo.SUBRESOURCES*
          :param bool whole_share: option to return all results or only the
           page size. *True* by DEFAULT.
          :param bool check: option to check query parameters and avoid erros.
           *True* by DEFAULT.
          :param bool augment: option to improve API response by adding
           some tags on the fly (like shares_id)
          :param bool tags_as_dicts: option to store tags as key/values by filter.
          :param str prot: https [DEFAULT] or http
           (use it only for dev and tracking needs).
          """; 103, assignment; 104, assignment; 105, assignment; 106, identifier:check; 107, block; 108, else_clause; 109, assignment; 110, block; 111, except_clause; 112, call; 113, assignment; 114, assignment; 115, boolean_operator; 116, comment:# if API returned more than one page of results, let's get the rest!; 117, block; 118, else_clause; 119, identifier:augment; 120, block; 121, else_clause; 122, identifier:tags_as_dicts; 123, block; 124, else_clause; 125, identifier:search_rez; 126, identifier:dict; 127, identifier:str; 128, identifier:list; 129, identifier:str; 130, identifier:str; 131, identifier:str; 132, identifier:str; 133, identifier:int; 134, identifier:int; 135, identifier:str; 136, identifier:list; 137, identifier:list; 138, identifier:bool; 139, identifier:bool; 140, identifier:bool; 141, identifier:bool; 142, identifier:str; 143, identifier:specific_md; 144, call; 145, identifier:include; 146, call; 147, identifier:payload; 148, dictionary; 149, expression_statement; 150, block; 151, identifier:search_url; 152, call; 153, expression_statement; 154, as_pattern; 155, block; 156, attribute; 157, argument_list; 158, identifier:search_rez; 159, call; 160, identifier:resources_count; 161, call; 162, comparison_operator:resources_count > page_size; 163, identifier:whole_share; 164, expression_statement; 165, comment:# a recipient list; 166, expression_statement; 167, comment:# now it'll get pages of 100 resources; 168, comment:# let's parse pages; 169, for_statement; 170, expression_statement; 171, block; 172, expression_statement; 173, if_statement; 174, block; 175, expression_statement; 176, comment:# clear; 177, expression_statement; 178, expression_statement; 179, comment:# update; 180, expression_statement; 181, expression_statement; 182, block; 183, attribute; 184, argument_list; 185, attribute; 186, argument_list; 187, pair; 188, pair; 189, pair; 190, pair; 191, pair; 192, pair; 193, pair; 194, pair; 195, pair; 196, pair; 197, pair; 198, pair; 199, call; 200, pass_statement; 201, attribute; 202, argument_list; 203, assignment; 204, identifier:Exception; 205, as_pattern_target; 206, expression_statement; 207, raise_statement; 208, identifier:checker; 209, identifier:check_api_response; 210, identifier:search_req; 211, attribute; 212, argument_list; 213, attribute; 214, argument_list; 215, identifier:resources_count; 216, identifier:page_size; 217, assignment; 218, assignment; 219, identifier:idx; 220, call; 221, block; 222, assignment; 223, pass_statement; 224, call; 225, identifier:share; 226, block; 227, else_clause; 228, pass_statement; 229, assignment; 230, call; 231, call; 232, call; 233, call; 234, pass_statement; 235, identifier:checker; 236, identifier:_check_filter_specific_md; 237, identifier:specific_md; 238, identifier:checker; 239, identifier:_check_filter_includes; 240, identifier:include; 241, string:"_id"; 242, identifier:specific_md; 243, string:"_include"; 244, identifier:include; 245, string:"_lang"; 246, attribute; 247, string:"_limit"; 248, identifier:page_size; 249, string:"_offset"; 250, identifier:offset; 251, string:"box"; 252, identifier:bbox; 253, string:"geo"; 254, identifier:poly; 255, string:"rel"; 256, identifier:georel; 257, string:"ob"; 258, identifier:order_by; 259, string:"od"; 260, identifier:order_dir; 261, string:"q"; 262, identifier:query; 263, string:"s"; 264, identifier:share; 265, attribute; 266, argument_list; 267, string:"{}://v1.{}.isogeo.com/resources/search"; 268, identifier:format; 269, identifier:prot; 270, attribute; 271, identifier:search_req; 272, call; 273, identifier:e; 274, call; 275, identifier:Exception; 276, identifier:search_req; 277, identifier:json; 278, identifier:search_rez; 279, identifier:get; 280, string:"total"; 281, identifier:metadatas; 282, list; 283, subscript; 284, integer:100; 285, identifier:range; 286, argument_list; 287, expression_statement; 288, expression_statement; 289, comment:# storing results by addition; 290, expression_statement; 291, subscript; 292, identifier:metadatas; 293, attribute; 294, argument_list; 295, expression_statement; 296, block; 297, identifier:new_tags; 298, call; 299, attribute; 300, argument_list; 301, attribute; 302, argument_list; 303, attribute; 304, argument_list; 305, attribute; 306, argument_list; 307, identifier:self; 308, identifier:lang; 309, identifier:checker; 310, identifier:check_request_parameters; 311, identifier:payload; 312, identifier:self; 313, identifier:api_url; 314, attribute; 315, argument_list; 316, attribute; 317, argument_list; 318, identifier:payload; 319, string:"_limit"; 320, integer:0; 321, binary_operator:int(ceil(resources_count / 100)) + 1; 322, assignment; 323, assignment; 324, call; 325, identifier:search_rez; 326, string:"results"; 327, identifier:self; 328, identifier:add_tags_shares; 329, call; 330, assignment; 331, expression_statement; 332, attribute; 333, argument_list; 334, call; 335, identifier:clear; 336, call; 337, identifier:clear; 338, call; 339, identifier:update; 340, subscript; 341, call; 342, identifier:update; 343, subscript; 344, identifier:self; 345, identifier:get; 346, identifier:search_url; 347, keyword_argument; 348, keyword_argument; 349, keyword_argument; 350, keyword_argument; 351, identifier:logging; 352, identifier:error; 353, identifier:e; 354, call; 355, integer:1; 356, subscript; 357, binary_operator:idx * 100; 358, identifier:search_req; 359, call; 360, attribute; 361, argument_list; 362, attribute; 363, argument_list; 364, subscript; 365, list; 366, assignment; 367, identifier:utils; 368, identifier:tags_to_dict; 369, keyword_argument; 370, keyword_argument; 371, attribute; 372, argument_list; 373, attribute; 374, argument_list; 375, attribute; 376, argument_list; 377, identifier:new_tags; 378, integer:0; 379, attribute; 380, argument_list; 381, identifier:new_tags; 382, integer:1; 383, identifier:headers; 384, attribute; 385, identifier:params; 386, identifier:payload; 387, identifier:proxies; 388, attribute; 389, identifier:verify; 390, attribute; 391, identifier:int; 392, argument_list; 393, identifier:payload; 394, string:"_offset"; 395, identifier:idx; 396, integer:100; 397, attribute; 398, argument_list; 399, identifier:metadatas; 400, identifier:extend; 401, call; 402, identifier:search_rez; 403, identifier:get; 404, string:"tags"; 405, call; 406, string:"_shares"; 407, identifier:share; 408, subscript; 409, list; 410, identifier:tags; 411, call; 412, identifier:prev_query; 413, call; 414, identifier:search_rez; 415, identifier:get; 416, string:"tags"; 417, identifier:search_rez; 418, identifier:get; 419, string:"query"; 420, identifier:search_rez; 421, identifier:get; 422, string:"tags"; 423, identifier:search_rez; 424, identifier:get; 425, string:"query"; 426, identifier:self; 427, identifier:header; 428, identifier:self; 429, identifier:proxies; 430, identifier:self; 431, identifier:ssl; 432, call; 433, identifier:self; 434, identifier:get; 435, identifier:search_url; 436, keyword_argument; 437, keyword_argument; 438, keyword_argument; 439, keyword_argument; 440, attribute; 441, argument_list; 442, attribute; 443, argument_list; 444, call; 445, string:"_shares"; 446, attribute; 447, argument_list; 448, attribute; 449, argument_list; 450, identifier:ceil; 451, argument_list; 452, identifier:headers; 453, attribute; 454, identifier:params; 455, identifier:payload; 456, identifier:proxies; 457, attribute; 458, identifier:verify; 459, attribute; 460, call; 461, identifier:get; 462, string:"results"; 463, identifier:search_rez; 464, identifier:get; 465, string:"query"; 466, attribute; 467, argument_list; 468, identifier:search_rez; 469, identifier:get; 470, string:"tags"; 471, identifier:search_rez; 472, identifier:get; 473, string:"query"; 474, binary_operator:resources_count / 100; 475, identifier:self; 476, identifier:header; 477, identifier:self; 478, identifier:proxies; 479, identifier:self; 480, identifier:ssl; 481, attribute; 482, argument_list; 483, identifier:search_rez; 484, identifier:get; 485, string:"query"; 486, identifier:resources_count; 487, integer:100; 488, identifier:search_req; 489, identifier:json
code: def search(
          self,
          token: dict = None,
          query: str = "",
          bbox: list = None,
          poly: str = None,
          georel: str = None,
          order_by: str = "_created",
          order_dir: str = "desc",
          page_size: int = 100,
          offset: int = 0,
          share: str = None,
          specific_md: list = [],
          include: list = [],
          whole_share: bool = True,
          check: bool = True,
          augment: bool = False,
          tags_as_dicts: bool = False,
          prot: str = "https",
      ) -> dict:
          """Search within the resources shared to the application.
  
          It's the main method to use.
  
          :param str token: API auth token - DEPRECATED: token is now automatically included
          :param str query: search terms and semantic filters. Equivalent of
           **q** parameter in Isogeo API. It could be a simple
           string like *oil* or a tag like *keyword:isogeo:formations*
           or *keyword:inspire-theme:landcover*. The *AND* operator
           is applied when various tags are passed.
          :param list bbox: Bounding box to limit the search.
           Must be a 4 list of coordinates in WGS84 (EPSG 4326).
           Could be associated with *georel*.
          :param str poly: Geographic criteria for the search, in WKT format.
           Could be associated with *georel*.
          :param str georel: geometric operator to apply to the bbox or poly
           parameters.
  
           Available values (see: *isogeo.GEORELATIONS*):
  
            * 'contains',
            * 'disjoint',
            * 'equals',
            * 'intersects' - [APPLIED BY API if NOT SPECIFIED]
            * 'overlaps',
            * 'within'.
  
          :param str order_by: sorting results.
  
           Available values:
  
            * '_created': metadata creation date [DEFAULT if relevance is null]
            * '_modified': metadata last update
            * 'title': metadata title
            * 'created': data creation date (possibly None)
            * 'modified': data last update date
            * 'relevance': relevance score calculated by API [DEFAULT].
  
          :param str order_dir: sorting direction.
  
           Available values:
            * 'desc': descending
            * 'asc': ascending
  
          :param int page_size: limits the number of results.
           Useful to paginate results display. Default value: 100.
          :param int offset: offset to start page size
           from a specific results index
          :param str share: share UUID to filter on
          :param list specific_md: list of metadata UUIDs to filter on
          :param list include: subresources that should be returned.
           Must be a list of strings. Available values: *isogeo.SUBRESOURCES*
          :param bool whole_share: option to return all results or only the
           page size. *True* by DEFAULT.
          :param bool check: option to check query parameters and avoid erros.
           *True* by DEFAULT.
          :param bool augment: option to improve API response by adding
           some tags on the fly (like shares_id)
          :param bool tags_as_dicts: option to store tags as key/values by filter.
          :param str prot: https [DEFAULT] or http
           (use it only for dev and tracking needs).
          """
          # specific resources specific parsing
          specific_md = checker._check_filter_specific_md(specific_md)
  
          # sub resources specific parsing
          include = checker._check_filter_includes(include)
  
          # handling request parameters
          payload = {
              "_id": specific_md,
              "_include": include,
              "_lang": self.lang,
              "_limit": page_size,
              "_offset": offset,
              "box": bbox,
              "geo": poly,
              "rel": georel,
              "ob": order_by,
              "od": order_dir,
              "q": query,
              "s": share,
          }
  
          if check:
              checker.check_request_parameters(payload)
          else:
              pass
  
          # search request
          search_url = "{}://v1.{}.isogeo.com/resources/search".format(prot, self.api_url)
          try:
              search_req = self.get(
                  search_url,
                  headers=self.header,
                  params=payload,
                  proxies=self.proxies,
                  verify=self.ssl,
              )
          except Exception as e:
              logging.error(e)
              raise Exception
  
          # fast response check
          checker.check_api_response(search_req)
  
          # serializing result into dict and storing resources in variables
          search_rez = search_req.json()
          resources_count = search_rez.get("total")  # total of metadatas shared
  
          # handling Isogeo API pagination
          # see: http://help.isogeo.com/api/fr/methods/pagination.html
          if resources_count > page_size and whole_share:
              # if API returned more than one page of results, let's get the rest!
              metadatas = []  # a recipient list
              payload["_limit"] = 100  # now it'll get pages of 100 resources
              # let's parse pages
              for idx in range(0, int(ceil(resources_count / 100)) + 1):
                  payload["_offset"] = idx * 100
                  search_req = self.get(
                      search_url,
                      headers=self.header,
                      params=payload,
                      proxies=self.proxies,
                      verify=self.ssl,
                  )
                  # storing results by addition
                  metadatas.extend(search_req.json().get("results"))
              search_rez["results"] = metadatas
          else:
              pass
  
          # add shares to tags and query
          if augment:
              self.add_tags_shares(search_rez.get("tags"))
              if share:
                  search_rez.get("query")["_shares"] = [share]
              else:
                  search_rez.get("query")["_shares"] = []
          else:
              pass
  
          # store tags in dicts
          if tags_as_dicts:
              new_tags = utils.tags_to_dict(
                  tags=search_rez.get("tags"), prev_query=search_rez.get("query")
              )
              # clear
              search_rez.get("tags").clear()
              search_rez.get("query").clear()
              # update
              search_rez.get("tags").update(new_tags[0])
              search_rez.get("query").update(new_tags[1])
          else:
              pass
          # end of method
          return search_rez