def test_explain(self): info = sruthi.explain('http://test.com/sru/') self.assertIsInstance(info, sruthi.response.ExplainResponse) self.session_mock.return_value.get.assert_called_once_with( 'http://test.com/sru/', params={ 'operation': 'explain', 'version': '1.2', })
def test_explain(self): info = sruthi.explain('http://test.com/sru/') self.assertEqual(info.sru_version, '1.2'), self.assertEqual(info['sru_version'], '1.2') self.assertIsInstance(info, sruthi.response.AttributeDict) self.session_mock.return_value.get.assert_called_once_with( 'http://test.com/sru/', params={ 'operation': 'explain', 'version': '1.2', } )
def print_title(s): cprint(s, attrs=['bold']) def dump(d): print(yaml.dump(d, allow_unicode=True, default_flow_style=False)) for endpoint in sru_endpoints: print_header(20 * '=') print_header('=') print_header(f'= {endpoint}') print_header('=') print_header(20 * '=') info = sruthi.explain(endpoint) print_title('Server:') dump(info.server) print('') print_title('Database:') dump(info.database) print('') print_title('Index:') dump(info.index) print('') print_title('Schema:') dump(info.schema)
import sruthi from pprint import pprint # check supported schemas of server server_url = 'https://suche.staatsarchiv.djiktzh.ch/SRU/' schema = 'isad' server = sruthi.explain(server_url) print(20 * '=') print('=') print(f"= Record with schema: {schema}") print('=') print(20 * '=') records = sruthi.searchretrieve( server_url, query='Zurich', record_schema=schema ) pprint(records[0])
import sruthi from pprint import pprint # check supported schemas of server server = sruthi.explain('http://lx2.loc.gov:210/LCDB?') print(f"Supported schemas: {', '.join(server.schema.keys())}") for schema in server.schema.keys(): print(20 * '=') print('=') print(f"= Record with schema: {schema}") print('=') print(20 * '=') records = sruthi.searchretrieve('http://lx2.loc.gov:210/LCDB?', query="human", record_schema=schema) pprint(records[0]) print('') print('')