Library class
- class almapiwrapper.config.Library(code: str | None = None, zone: str | None = None, env: Literal['P', 'S'] | None = 'P', library_id: str | None = None, data: Dict | JsonData | str | None = None)
Bases:
RecordClass representing a library
- Variables:
code – code of the library
zone – zone of the library
env – environment of the library: ‘P’ for production and ‘S’ for sandbox
library_id – library id (number)
data – data of the library,
almapiwrapper.record.JsonDataobject
- static api_call(method: Literal['get', 'put', 'post', 'delete'], *args, **kwargs) Response | None
Static method to handle http errors. Quit the program after 3 failed tries
- Parameters:
method – ‘get’, ‘put’, ‘post’ or ‘delete’ according to the api method call
- static build_headers(data_format: Literal['json', 'xml'], zone: str, area: str, rights: Literal['R', 'RW'] = 'RW', env: Literal['P', 'S'] | None = 'P') Dict
Build the headers for the API calls.
- Parameters:
data_format – “json” or “xml”
zone – optional, if indicated allow to make the query in an other IZ
area – area of the record, bibs, users for example
rights – “R” for read only or “RW” for write and read rights
env – environment of the api call: ‘P’ for production, ‘S’ for sandbox
- Returns:
dict with the headers
- property data: Dict | Element | DataFrame | None
Property that get xml data with API call. If not available, make an api call
- Returns:
xml data, dictionary or pandas dataframe
- property departments: List[Department]
Property to get the departments of the library
- Returns:
list of departments of the library
- property desks: List[Desk]
Property to get the desks of the library
- Returns:
list of desks of the library
- property locations: List[Location]
Property to get the locations of the library
- Returns:
list of locations of the library
- Library.open_hours -> 'OpenHours'
Get the open hours of the library
- Returns:
object
almapiwrapper.library.OpenHours
- static parse_data(data: JsonData | XmlData | Dict | str) JsonData | XmlData | None
Parse the data and return a parsed data object or None if an error occurs
- Parameters:
data – data to be parsed
- Returns:
parsed data object or None if an error occurs