Skip to main content

Tools for interacting with the "AJuM" database

Project description

we-love-ajum

Build

This small library is a Python wrapper for ajum.de, querying the book review database of the german working group for children's and youth literature and media ("Arbeitsgemeinschaft Jugendliteratur und Medien" or "AJuM"), which is part of the german Education and Science Worker's Union ("Gewerkschaft Erziehung und Wissenschaft" or "GEW").

We deem their work to be invaluable for kindergartens, (pre)schools, universities and other educational institutions. We are thankful for AJuM's commitment and want to give something back by spreading the word and provide an easy way to interact with their review database.

Note: Since we DO NOT UNDER ANY CIRCUMSTANCES want to disrupt their services, asyncio.sleep() is called after each API request.

The included ajum/data/index.json file contains URL slugs for each ISBN. It was created using --strict mode, skipping invalid ISBNs - currently totalling 46203 (valid) ISBNs with 87939 reviews (averaging 1.90 reviews per ISBN).

Getting started

Simply install all dependencies inside a virtual environment to get started:

# Set up & activate virtualenv
virtualenv -p python3 venv

# shellcheck disable=SC1091
source venv/bin/activate

# Install dependencies, either ..
# (1) .. from PyPi (stable)
python -m pip install ajum

# (2) .. from repository (dev)
python -m pip install --editable .

From there, it's easy to roll out your own script:

from ajum import Ajum

# Initialize object
ajum = Ajum()

# Fetch reviews from first page
slugs = ajum.get_slugs():

# Display their data:
print(ajum.get_reviews(slugs))

For more examples, have a look at src/cli.py and src/ajum.py to get you started - feedback appreciated, as always!

Usage

The following commands are available:

$ ajum --help
Usage: ajum [OPTIONS] COMMAND [ARGS]...

  Tools for interacting with the 'AJuM' database.

Options:
  -c, --config PATH  Path to user settings file.
  -u, --ua PATH      Path to "UA" strings file.
  -v, --verbose      Enable verbose mode.
  --version          Show the version and exit.
  --help             Show this message and exit.

Commands:
  backup  Backs up remote database
  clear   Removes cached results files
  export  Exports review data to FILE
  query   Queries remote database
  show    Shows data for given ISBN
  stats   Shows statistics

Commands

backup

.. remote database:

$ ajum backup --help
Usage: ajum backup [OPTIONS]

  Backs up remote database

Options:
  -p, --parallel INTEGER  Number of parallel downloads.
  -n, --number INTEGER    Number of results pages to be scraped.
  --help                  Show this message and exit.

export

.. review data as index (or full database):

$ ajum export --help
Usage: ajum export [OPTIONS] [FILE]

  Exports review data to FILE

Options:
  -s, --strict        Whether to skip invalid ISBNs.
  -f, --full          Whether to export full database.
  -j, --jobs INTEGER  Number of jobs.
  --help              Show this message and exit.

show

.. review data for given ISBN:

$ ajum show --help
Usage: ajum show [OPTIONS] ISBN

  Shows data for given ISBN

Options:
  --help  Show this message and exit.

query

.. remote database for given search terms:

Usage: aj$ ajum query --help
um query [OPTIONS]

  Queries remote database

Options:
  -q, --query TEXT         Search term.
  -t, --search-field TEXT  Search field type.
  -r, --rating TEXT        Rating.
  -f, --application TEXT   Field of application.
  -m, --media-type TEXT    Media type.
  -t, --topics TEXT        Topics.
  -a, --ages TEXT          Recommendable age range(s).
  -y, --year TEXT          Publishing year.
  --help                   Show this message and exit.

stats

.. about (cached) reviews:

$ ajum stats --help
Usage: ajum stats [OPTIONS]

  Shows statistics

Options:
  --help  Show this message and exit.

clear

.. cached results files:

$ ajum clear --help
Usage: ajum clear [OPTIONS]

  Removes cached results files

Options:
  -r, --reset  Whether to remove cached results pages.
  --help       Show this message and exit.

Disclaimer

For legal reasons we only provide you with the means to download reviews. We assume neither ownership nor intellectual property of any review - they are publically available on the AJuM website and are subject to their legal sphere alone.

Happy coding!

:copyright: Fundevogel Kinder- und Jugendbuchhandlung

Project details


Download files

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

Source Distribution

ajum-0.8.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

ajum-0.8.0-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file ajum-0.8.0.tar.gz.

File metadata

  • Download URL: ajum-0.8.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

File hashes

Hashes for ajum-0.8.0.tar.gz
Algorithm Hash digest
SHA256 3cb7015217039043896c850e652e67bd41f26edf1c801dcdd26a445b6159d3de
MD5 5e16508b0b5a8dfcd6f489216289abba
BLAKE2b-256 7129322eba03c3433032d747ae87002551eb489e0dbbfa05aed87e5f9b680226

See more details on using hashes here.

File details

Details for the file ajum-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: ajum-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.4.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.7

File hashes

Hashes for ajum-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d323da2e7cce648c113ec656219675287b321c622a2c105dd00a5d3dc6c39f3a
MD5 67156dba232838c600c2bf3fe2579a47
BLAKE2b-256 a1795ee6c85c83c3a41934ef2cb7042841bd1a13010e98d71969619b14731ec9

See more details on using hashes here.

Supported by

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