# Source code for api.pdns.v3.search

    """Autogenerated API"""
    import requests
    from argus_cli.plugin import register_command

    @register_command(extending=('pdns','v3','search'))
    def search_records(query: str = None, rrClass: list = None, rrType: list = None, customerID: list = None, tlp: list = None, limit: int = None, aggregateResult: bool = 'False', includeAnonymousResults: bool = 'False', offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Search against PassiveDNS with criteria and return matching records (PUBLIC)
    Search against PassiveDNS with criteria and return matching records. If user exceeds current resource limits, this operation may return status code 402. If that happens, the metaData key millisUntilResourcesAvailable gives a hint as to how long the client needs to wait before attempting again.

        :param str query: Lookup query
        :param list rrClass: Lookup with specified record classes
        :param list rrType: Lookup with specified record types
        :param list customerID: Lookup for specified customer IDs
        :param list tlp: Lookup with specified TLPs, public usage only TLP white allowed
        :param int limit: Max number of results to be returned, default unset means default limit 25 will be used, 0 means unlimited
        :param bool aggregateResult: Whether aggregate results (default true)
        :param bool includeAnonymousResults: Whether include anonymous results (default true)
        :param int offset: Number of results to be skipped first, default 0 (default 0)
        :raises AuthenticationFailedException: on 401
        :raises ValidationFailedException: on 412
        :raises ResourceLimitExceeded.Exception: on 402
        :raises AccessDeniedException: on 403
        :returns: {"offset": 123, "limit": 718, "responseCode": 200, "count": 352, "data": [{"createdTimestamp": 444206024, "lastUpdatedTimestamp": 220032127, "times": 935, "tlp": "amber", "query": "Beautiful coach decide manager agency listen.", "answer": "Thing series store five floor region size she.", "minTtl": 939, "maxTtl": 856, "lastSeenTimestamp": 773469086, "firstSeenTimestamp": 1153741153, "rrclass": "in", "rrtype": "mx"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Computer perform own experience here.", "messageTemplate": "Sometimes letter red.", "field": "Ok grow room.", "parameter": {}, "timestamp": 932316742}], "currentPage": 29, "size": 635}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/pdns/v3/search".format()
        headers = {
            'Content-Type': 'application/json',
            'User-Agent': 'ArgusToolbelt/1.0'
        }

        if apiKey:
            headers["Argus-API-Key"] = apiKey
        elif authentication and isinstance(authentication, dict):
            headers.update(authentication)
        elif callable(authentication):
            headers.update(authentication(url))

        body = {}

        if query:
            body.update({"query": query})

        if aggregateResult:
            body.update({"aggregateResult": aggregateResult})

        if includeAnonymousResults:
            body.update({"includeAnonymousResults": includeAnonymousResults})

        if rrClass:
            body.update({"rrClass": rrClass})

        if rrType:
            body.update({"rrType": rrType})

        if customerID:
            body.update({"customerID": customerID})

        if tlp:
            body.update({"tlp": tlp})

        if limit:
            body.update({"limit": limit})

        if offset:
            body.update({"offset": offset})

        response = post(url, json=body if body else None, verify=verify, headers=headers)

        errors = []
        if response.status_code == 401:
            raise http.AuthenticationFailedException(response)
        elif response.status_code == 403:
            raise http.AccessDeniedException(response)
        elif response.status_code == 412:
            raise http.ValidationErrorException(response)
        elif response.status_code == 404:
            raise http.ObjectNotFoundException(response)

        return response.json() if json else response