Skip to main content

Project COUNTER/NISO SUSHI statistics

Project description Latest Version Documentation Status

pycounter makes working with COUNTER usage statistics in Python easy, including fetching statistics with NISO SUSHI.

A simple command-line client for fetching JR1 reports from SUSHI servers and outputting them as tab-separated COUNTER 4 reports is included.

Developed by the Health Sciences Library System of the University of Pittsburgh to support importing usage data into our in-house Electronic Resources Management (ERM) system.

Licensed under the MIT license. See the file LICENSE for details.

pycounter is tested on Python 2.6, 2.7, 3.3, 3.4, 3.5, and pypy2

Documentation is on Read the Docs.


>From pypi:

pip install pycounter

>From inside the source distribution:

python install

About dependencies: pycounter uses lxml, an XML parsing library with a C extension. It requires libxml2 and libxslt to be installed to build correctly. It may be helpful to install lxml manually before installing pycounter, either with the Windows binary installers, a linux distro package, or with macports or homebrew on OS X. See the lxml installation docs for more information.


Parsing COUNTER reports (currently supports COUNTER 3 and 4, in .csv, .tsv, or .xlsx files, reports JR1, DB1, DB2, BR1, and BR2):

>>> import
>>> report ="COUNTER4_2015.tsv")  # filename or path to file
>>> print(report.metric)
FT Article Requests
>>> for journal in report:
...     print(journal.title)
Sqornshellous Swamptalk
Acta Mattressica
>>> for stat in report.pubs[0]:
...     print(stat)
(, 1, 1), 'FT Article Requests', 120)
(, 2, 1), 'FT Article Requests', 42)
(, 3, 1), 'FT Article Requests', 23)

Fetching SUSHI data:

>>> import pycounter.sushi
>>> import datetime
>>> report = pycounter.sushi.get_report(wsdl_url='',
...     requestor_id="myreqid", customer_reference="refnum", report="JR1",
...     release=4)
>>> for journal in report:
...     print(journal.title)
Sqornshellous Swamptalk
Acta Mattressica

Output of report as TSV:

>>> report.write_tsv("/tmp/counterreport.tsv")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pycounter, version 0.11.0
Filename, size File type Python version Upload date Hashes
Filename, size pycounter-0.11.0-py2.py3-none-any.whl (132.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pycounter-0.11.0.tar.gz (54.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page