NewUser
class
- class almapiwrapper.users.NewUser(zone: str, env: Literal['P', 'S'], data: JsonData)
Bases:
User
Class used to create new users
- Variables
zone – initial value: zone where the user should be created
env – initial value: environment of the entity: ‘P’ for production and ‘S’ for sandbox
data – initial value:
almapiwrapper.record.JsonData
of the user to create
- add_synchro_note() 'User'
Add a test synchronization notes
- Returns
object
almapiwrapper.users.User
- static build_headers(data_format: Literal['json', 'xml'], zone: str, area: str, rights: Literal['R', 'RW'] = 'RW', env: Optional[Literal['P', 'S']] = '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
- check_synchro_note() bool
Test if the user has a synchronization test note
- Returns
True if a synchronization test note is found else False
- create(password: Optional[str] = None) Union['NewUser', User]
Create the user with API.
- Parameters
password – optional string with the password, if not provided, the password will be set at the default value (if not available in the data)
- Returns
object
almapiwrapper.users.User
or objectalmapiwrapper.users.NewUser
(in case of error)
Note
If the record encountered an error, this method will be skipped.
- create_loan(library: str, circ_desk: str, item_barcode: Optional[str] = None, item_id: Optional[str] = None, item: Optional[almapiwrapper.inventory.Item] = None) Optional['users.Loan']
Create a loan for the user
- Parameters
library – code of the library
circ_desk – code of the circulation desk
item_barcode – barcode of the item
item_id – id of the item
item – object
almapiwrapper.inventory.Item
- Returns
object
almapiwrapper.users.Loan
Note
If the record encountered an error, this method will be skipped.
- property data: Optional[Union[Dict, Element, DataFrame]]
Property that get xml data with API call. If not available, make an api call
- Returns
xml data, dictionary or pandas dataframe
- delete()
Delete the user
- Returns
None
Note
If the record encountered an error, this method will be skipped.
- property fees: Optional[List[Fee]]
Property returning the list of the fees of the user
- Returns
list of
almapiwrapper.users.Fee
objects
- property loans: Optional[List[Loan]]
Property returning the list of the loans of the user
- Returns
list of
almapiwrapper.users.Loan
objects
- property primary_id: str
Property returning the primary ID
It fetches it in a private attribute if not available in the data property.
When a new value is set and json data is available, it changes the primary ID at the data level.
- Returns
primary ID of the user
- remove_synchro_note() 'User'
Remove all test synchronization notes
- Returns
object
almapiwrapper.users.User
- save() 'User'
Save a user record in the ‘records’ folder
When saved, a suffix is added to the file path with the version. Example: records/<primary_id>/user_<IZ>_<primary_id>_<version>.xml
- Returns
object
almapiwrapper.users.User
- set_password(password: Optional[str] = None) 'NewUser'
Set the password of a new user
- Parameters
password – string containing the new password.
- Returns
object
almapiwrapper.users.NewUser
Note
If the record encountered an error, this method will be skipped.
- update() 'User'
Update the user through api
- Parameters
override – string containing the list of the fields to override
- Returns
object
almapiwrapper.users.User
Note
If the record encountered an error, this method will be skipped.