diff --git a/webarchiv.py b/webarchiv.py index a809cca2e61374092221027947dacb89404aebb8..4dd3bd6481402e577c4a3ed7da66102cd4ea4f05 100644 --- a/webarchiv.py +++ b/webarchiv.py @@ -189,10 +189,34 @@ class WebarchivSession: return r + def domain_name_search(self, query_string, page_=1, pagesize_=100): + """ + Start a domain name search in the Webarchive. + The current status of running queries can be read via status_open_queries(). + + :param query_string: String to search for + :param page_: The page number parameter works with the page size parameter to control the offset of the records returned in the results. Default value is 1 + :param pagesize_: The page size parameter works with the page number parameter to control the offset of the records returned in the results. It also controls how many results are returned with each request. Default value is 10 + :return: result as json + """ + params = {'q': query_string} + if page_: + params['page'] = page_ + if pagesize_: + params['pagesize'] = pagesize_ + + try: + response = self._get(op='/search/domainname', params=params) + return self.waitForResponse(response) + + except HTTPError as e: + self._display_http_error(e) + print('Error:'.format(query_string)) + if __name__ == '__main__': # noinspection SpellCheckingInspection - w = WebarchivSession('Zz2tQls7fuaocX2pjrfc2npojqbGwXL2') + w = WebarchivSession('2pm8i0hnmpcTK4Oj4CUeBoZd7vywrm4c') # response = w.wayback_search("http://www.onb.ac.at") #response = w.wayback_search("http://frauenhetz.jetzt") response = w.fulltext_search("Nationalbibliothek Prunksaal Schwarzenegger")