nodes: 0, module; 1, function_definition; 2, function_name:search_videohub; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# construct url; 14, expression_statement; 15, comment:# construct auth headers; 16, expression_statement; 17, comment:# construct payload; 18, expression_statement; 19, if_statement; 20, if_statement; 21, if_statement; 22, if_statement; 23, if_statement; 24, comment:# send request; 25, expression_statement; 26, comment:# raise if not 200; 27, if_statement; 28, comment:# parse and return response; 29, return_statement; 30, identifier:filters; 31, None; 32, identifier:status; 33, None; 34, identifier:sort; 35, None; 36, identifier:size; 37, None; 38, identifier:page; 39, None; 40, comment:"""searches the videohub given a query and applies given filters and other bits
  
          :see: https://github.com/theonion/videohub/blob/master/docs/search/post.md
          :see: https://github.com/theonion/videohub/blob/master/docs/search/get.md
  
          :param query: query terms to search by
          :type query: str
          :example query: "brooklyn hipsters"  # although, this is a little redundant...
  
          :param filters: video field value restrictions
          :type filters: dict
          :default filters: None
          :example filters: {"channel": "onion"} or {"series": "Today NOW"}
  
          :param status: limit the results to videos that are published, scheduled, draft
          :type status: str
          :default status: None
          :example status: "published" or "draft" or "scheduled"
  
          :param sort: video field related sorting
          :type sort: dict
          :default sort: None
          :example sort: {"title": "desc"} or {"description": "asc"}
  
          :param size: the page size (number of results)
          :type size: int
          :default size: None
          :example size": {"size": 20}
  
          :param page: the page number of the results
          :type page: int
          :default page: None
          :example page: {"page": 2}  # note, you should use `size` in conjunction with `page`
  
          :return: a dictionary of results and meta information
          :rtype: dict
          """; 41, assignment; 42, assignment; 43, assignment; 44, identifier:filters; 45, block; 46, identifier:status; 47, block; 48, identifier:sort; 49, block; 50, identifier:size; 51, block; 52, identifier:page; 53, block; 54, assignment; 55, comparison_operator:res.status_code != 200; 56, block; 57, call; 58, identifier:url; 59, call; 60, identifier:headers; 61, dictionary; 62, identifier:payload; 63, dictionary; 64, assert_statement; 65, expression_statement; 66, assert_statement; 67, expression_statement; 68, expression_statement; 69, assert_statement; 70, expression_statement; 71, assert_statement; 72, expression_statement; 73, assert_statement; 74, expression_statement; 75, identifier:res; 76, call; 77, attribute; 78, integer:200; 79, expression_statement; 80, attribute; 81, argument_list; 82, identifier:getattr; 83, argument_list; 84, pair; 85, pair; 86, pair; 87, call; 88, assignment; 89, call; 90, call; 91, assignment; 92, call; 93, assignment; 94, call; 95, assignment; 96, call; 97, assignment; 98, attribute; 99, argument_list; 100, identifier:res; 101, identifier:status_code; 102, call; 103, identifier:json; 104, identifier:loads; 105, attribute; 106, identifier:settings; 107, string:"VIDEOHUB_API_SEARCH_URL"; 108, attribute; 109, string:"Content-Type"; 110, string:"application/json"; 111, string:"Authorization"; 112, attribute; 113, string:"query"; 114, identifier:query; 115, identifier:isinstance; 116, argument_list; 117, subscript; 118, identifier:filters; 119, identifier:isinstance; 120, argument_list; 121, attribute; 122, argument_list; 123, subscript; 124, identifier:status; 125, identifier:isinstance; 126, argument_list; 127, subscript; 128, identifier:sort; 129, identifier:isinstance; 130, argument_list; 131, subscript; 132, identifier:size; 133, identifier:isinstance; 134, argument_list; 135, subscript; 136, identifier:page; 137, identifier:requests; 138, identifier:post; 139, identifier:url; 140, keyword_argument; 141, keyword_argument; 142, attribute; 143, argument_list; 144, identifier:res; 145, identifier:content; 146, identifier:cls; 147, identifier:DEFAULT_VIDEOHUB_API_SEARCH_URL; 148, identifier:settings; 149, identifier:VIDEOHUB_API_TOKEN; 150, identifier:filters; 151, identifier:dict; 152, identifier:payload; 153, string:"filters"; 154, identifier:status; 155, attribute; 156, identifier:payload; 157, identifier:setdefault; 158, string:"filters"; 159, dictionary; 160, subscript; 161, string:"status"; 162, identifier:sort; 163, identifier:dict; 164, identifier:payload; 165, string:"sort"; 166, identifier:size; 167, tuple; 168, identifier:payload; 169, string:"size"; 170, identifier:page; 171, tuple; 172, identifier:payload; 173, string:"page"; 174, identifier:data; 175, call; 176, identifier:headers; 177, identifier:headers; 178, identifier:res; 179, identifier:raise_for_status; 180, identifier:six; 181, identifier:string_types; 182, identifier:payload; 183, string:"filters"; 184, attribute; 185, identifier:int; 186, attribute; 187, identifier:int; 188, attribute; 189, argument_list; 190, identifier:six; 191, identifier:string_types; 192, identifier:six; 193, identifier:string_types; 194, identifier:json; 195, identifier:dumps; 196, identifier:payload
code: def search_videohub(cls, query, filters=None, status=None, sort=None, size=None, page=None):
          """searches the videohub given a query and applies given filters and other bits
  
          :see: https://github.com/theonion/videohub/blob/master/docs/search/post.md
          :see: https://github.com/theonion/videohub/blob/master/docs/search/get.md
  
          :param query: query terms to search by
          :type query: str
          :example query: "brooklyn hipsters"  # although, this is a little redundant...
  
          :param filters: video field value restrictions
          :type filters: dict
          :default filters: None
          :example filters: {"channel": "onion"} or {"series": "Today NOW"}
  
          :param status: limit the results to videos that are published, scheduled, draft
          :type status: str
          :default status: None
          :example status: "published" or "draft" or "scheduled"
  
          :param sort: video field related sorting
          :type sort: dict
          :default sort: None
          :example sort: {"title": "desc"} or {"description": "asc"}
  
          :param size: the page size (number of results)
          :type size: int
          :default size: None
          :example size": {"size": 20}
  
          :param page: the page number of the results
          :type page: int
          :default page: None
          :example page: {"page": 2}  # note, you should use `size` in conjunction with `page`
  
          :return: a dictionary of results and meta information
          :rtype: dict
          """
          # construct url
          url = getattr(settings, "VIDEOHUB_API_SEARCH_URL", cls.DEFAULT_VIDEOHUB_API_SEARCH_URL)
          # construct auth headers
          headers = {
              "Content-Type": "application/json",
              "Authorization": settings.VIDEOHUB_API_TOKEN,
          }
          # construct payload
          payload = {
              "query": query,
          }
          if filters:
              assert isinstance(filters, dict)
              payload["filters"] = filters
          if status:
              assert isinstance(status, six.string_types)
              payload.setdefault("filters", {})
              payload["filters"]["status"] = status
          if sort:
              assert isinstance(sort, dict)
              payload["sort"] = sort
          if size:
              assert isinstance(size, (six.string_types, int))
              payload["size"] = size
          if page:
              assert isinstance(page, (six.string_types, int))
              payload["page"] = page
          # send request
          res = requests.post(url, data=json.dumps(payload), headers=headers)
          # raise if not 200
          if res.status_code != 200:
              res.raise_for_status()
          # parse and return response
          return json.loads(res.content)