AnalyticsReport class

class almapiwrapper.analytics.AnalyticsReport(path: str, zone: str, env: Optional[Literal['P', 'S']] = 'P', filter_to_apply: Optional[str] = None)

Bases: Record

Class representing an Analytics report

Variables
  • api_base_url_analytics – url of the analytics api

  • path – path of the report

  • zone – initial value: zone of the report

  • env – initial value: environment of the entity: ‘P’ for production and ‘S’ for sandbox

  • dataalmapiwrapper.record.XmlData with raw report data

  • report_name – name of the report

  • filter – filter of the report

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

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

save(self, format: Optional[Literal['json', 'csv']] = 'csv') 'analyticslib.AnalyticsReport'

Save a user fee record in the ‘records’ folder

When saved, a suffix is added to the file path with the version. Example: records/report_<report_name>/report_<report_name>_<IZ>_<version>.xml

Returns

object almapiwrapper.analytics.AnalyticsReport