aim.digifeeds.db_client module

class aim.digifeeds.db_client.DBClient[source]

Bases: object

add_item(barcode: str)[source]

Add an item to the digifeeds database

Parameters:

barcode (str) – Barcode of the item

Returns:

A response object

Return type:

json

add_item_status(barcode: str, status: str)[source]

Add a status to an item in the database

Parameters:
  • barcode (str) – Barcode of the item

  • status (str) – Status to add

Returns:

A response object

Return type:

json

get_item(barcode: str)[source]

Get an item from the digifeeds database

Parameters:

barcode (str) – Barcode of the item

Returns:

A response object

Return type:

json

get_items(limit: int = 50, q: str | None = None) list[source]

Pages through all items to return a list. Takes an optional q string to filter the list of items

Parameters:
  • limit (int, optional) – How many items to fetch with each page. Changing this still results in getting all matching results. Defaults to 50.

  • q (str | None, optional) – Query string that the api is expecting. Defaults to None.

Returns:

List of item objects.

Return type:

list

get_or_add_item(barcode: str)[source]

Gets or adds an item to the digifeeds database

Parameters:

barcode (str) – Barcode of the item

Returns:

An item

Return type:

Object

update_hathifiles_timestamp(barcode: str, timestamp: datetime)[source]

Updates the hathifiles_timestamp field for an existing barcode

Parameters:
  • barcode (str) – Barcode of the item

  • timestamp (datetime) – rights_timestamp value from Hathifiles DB

Returns:

A response object

Return type:

json