Skip to main content

sruthi

sruthi is a client for python to make SRU requests (Search/Retrieve via URL).

Currently only SRU 1.2 is supported.

Table of Contents

Installation

sruthi is available on PyPI, so to install it simply use:

$ pip install sruthi

Usage

See the examples directory for more scripts.

searchretrieve operation

import sruthi

records = sruthi.searchretrieve('https://suche.staatsarchiv.djiktzh.ch/SRU/', query='Zurich')

for record in records:
    # print fields from schema
    print(record['reference'])
    print(record['title'])
    print(record['date'])
    print(record['extra']['link']) # extra record data is available at the 'extra' key
# you can get more information at each step
import sruthi

# note: records is an iterator
records = sruthi.searchretrieve('https://suche.staatsarchiv.djiktzh.ch/SRU/', query='Human')
print(records.sru_version)
print(records.count)

for record in records:
    print(record)
    print(record['schema'])

The return value of searchretrieve is iterable, so you can easily loop over it. Or you can use indices to access elements, e.g. records[1] to get the second elemenet, or records[-1] to get the last one.

Even slicing is supported, so you can do things like only iterate over the first 5 elements using

for records in records[:5]:
   print(record)

explain operation

import sruthi

info = sruthi.explain('https://suche.staatsarchiv.djiktzh.ch/SRU/')
print(info.server)
print(info.database)
print(info.index)
print(info.schema)

Schemas

sruthi does not make any assumptions about the record data schema. The data is provided as-is (as a flattend dict). sruthi has been tested with the following schemas:

Release

To create a new release, follow these steps (please respect Semantic Versioning):

  1. Adapt the version number in sruthi/__init__.py
  2. Update the CHANGELOG with the version
  3. Create a pull request to merge develop into master (make sure the tests pass!)
  4. Create a new release/tag on GitHub (on the master branch)
  5. The publication on PyPI happens via GitHub Actions on every tagged commit

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sruthi-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sruthi-0.1.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file sruthi-0.1.1.tar.gz.

File metadata

  • Download URL: sruthi-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for sruthi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 93a75f57e151080daa0afba1adb360bbbe484462de3080879589fc0b5dd1f672
MD5 922488fc909be3566546fab55d9ae82b
BLAKE2b-256 54aca5a78c257d44e2ef5c3e698b484c7ba6b7e0aa7c02ea5125d63a9473da1b

See more details on using hashes here.

File details

Details for the file sruthi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sruthi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for sruthi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a0c2e0ffab22586161981407c1a7e30ca4b21c546759829cebcb64a775e3d005
MD5 c4c67ae89fc0e7031b2d0cbc82ac86ef
BLAKE2b-256 d6b747099f6285ed94fe75b22cf81c3ef32fc396192fccee7686524f2f032afc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page