Vendor class
- class almapiwrapper.acquisitions.Vendor(vendor_code: str | None = None, zone: str | None = None, env: Literal['P', 'S'] | None = 'P', data: dict | JsonData | None = None)
Bases:
RecordClass representing a Vendor
- Variables:
vendor_code – initial value: code of the vendor
zone – initial value: zone of the vendor
env – initial value: environment of the entity: ‘P’ for production and ‘S’ for sandbox
data –
almapiwrapper.record.JsonDatawith raw vendor data
- 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
- create(self) acquisitionslib.Vendor
Create a Vendor
- Note:
The vendor code must be unique, same for the account_id of each account.
- Returns:
object
almapiwrapper.acquisitions.Vendor
- 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
- delete(self) None
Delete the Vendor
- 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
- property polines
Get the PO Lines associated with the Vendor
- Returns:
list of
almapiwrapper.acquisitions.PoLineobjects
- save(self) acquisitionslib.Vendor
Save a PO Line record in the ‘records’ folder
When saved, a suffix is added to the file path with the version. Example: records/vendors/vendor_<IZ>_<set_id>_<version>.xml
- Returns:
object
almapiwrapper.acquisitions.Vendor
Note
If the record encountered an error, this method will be skipped.
- update(self) 'acquisitionslib.Vendor'
Update the Vendor
Note
If the record encountered an error, this method will be skipped.
- Returns:
object
almapiwrapper.acquisitions.Vendor