{ "info": { "author": "Ed Hill", "author_email": "hill.charles2@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "##Check for EZProxy configurations\n\n\nA simple command-line script to check that EZProxy configurations exist\nfor library databases. Built for checking LibGuides A-Z databases and\nOCLC Knowledge Base, but can be easily extended. Built/Tested with\nPython 3.4, but should work back to at least 2.7.\n\n##Installation\n\nEasiest way is:\n\n``pip install check_ezproxy``\n\nOr:\n\n1. Clone the repository.\n\n2. Optional: If you want to make the file exectuable, run ``chmod +x check_ezproxy_run.py`` (in a bash system; this makes it so you shouldn't have to prepend each call with python)\n\n3. From the main directory, run ``python check_ezproxy_run.py -args`` (or ``./check_ezproxy_run.py -args`` if you did step 2 above)\n\n4. Run ``python setup.py install`` to install (after this, you can just use the ``check_ezproxy``, setup makes it available everywhere)\n\nOr use Docker:\n\n1. Clone the repository\n\n2. Edit the Dockerfile to fill in your information for environment variables (takes the place of editing cfg or JSON config)\n\n3. With your Docker daimon running and from the project root, run ``docker build -t check_ezproxy .``\n\n4. Now you can run Docker run commands with flags for this tool at the end, i.e. ``docker run check_ezproxy --urlsource=libguides``\n\nDocker support is still fairly limited, and with the current Dockerfile you won't be able to check KBART files or use a JSON config.\n\n\n##Use\n\nInstalling via pip or setup.py will make the ``check_ezproxy`` command\navailable globally. It is suggested you install it into a virtual\nenvironment to:\n\n1. not permanently pollute the global namespace in your shell\n\n2. not pollute your base Python packages, as this utility uses some\n popular libraries and even if this tool isn't necessarily reliant on\n a particular version, another tool might be. Best to keep em\n separated.\n\n##Configuration\n\nSome minimal configuration is needed for the checks to be able to run,\nand there are a couple of ways to supply this.\n\n- Rename 'config\\_template.py' to 'config.py' and supply the listed parameters. This is best for quick testing or if you want to extend the tool.\n\n- Make a .json file containing the necessary config, then point the tool to it with the -c argument. You can optionally use a -s flag to save these configs so you don't need to point toward them again, but note that these will override any other configs you may try to give. You will need to use ``--flush-config`` to use another configuration.\n\n- You can also use the package as a tool for making your own utility and provide config in your script. Details below.\n\nConfigurations to set are:\n\n- **ezproxy_prefix**- the full prefix for your EZProxy server, protocol included\n- **libguides_api_url**- The full URL to LibGuides API for database assets including your site id, API key, and asset\\_type=10 as query parameters (v. 1.1 only at this time, v. 1.2 soon)\n- **ezproxy_error_text**- Some text on your page for proxied links with no stanzas set that you can be relatively sure is unique. The tool will match against this the page text to determine which links are not properly configured.\n- **kb_wskey**- If you want to check links directly from the OCLC knowledge base, you will need to apply for an API key. Only the WSKey is needed here, not the secret.\n- **kb_collections**- The name of the collections in the knowledge base to check. If using Python for config these can be in a tuple or list (or any iterable), if using JSON they go in an array. Even if you only have 1 to check, it needs to be in an iterable wrapper.\n\n##Arguments\n\n\nNote: none of these arguments are mandatory, though some rely on others\nto be set as well.\n\n**-u, --urlsource**\n\nThe location to get the urls to run the check on. Current possible options are 'libguides',\n'oclc', and 'kbart' (will have to use -k to provide the path to the\nKBART file to check. -k can be used on its own as well).\n\n\n**-t, --type**\n\nThe type of check to run. Current supported checks are 'text' and\n'link'.\n\n``-t text`` will make a call to retrieve the page through the proxy\nserver and compare the text returned to known error text (can't use\nstatus codes because those are 200 even for a wrongly configured\ndatabase). At Westfield this text is 'your EZproxy administrator must\nfirst' but you will need to set comparison text for your institution as\nERROR\\_TEXT in constants.py ``-t links`` will just make a head request\nand check the status code.\n\n**-k, --kbart**\n\nThe path to a kbart file to check. If using this, it is not necessary to\nset a --urlsource, though it is fine to do so. The path can be relative,\nabsolute, or relative to your home directory (~)\n\n\n**-w, --write**\n\nWrite the output to a file rather than printing to the standard output\n\n\n**-f, --output-file**\n\nThe path and filename you wish to use in conjunction with the ``-w``. It\nis necessary to also use ``-w``, but if you do not specify a file here\nit will default to 'check\\_proxy.txt' in your home directory.\n\n\n**-p, --proxy**\n\nForce the presence or absence of a proxy prefix. Acceptable values are:\n- ``force``\n\n- ``no_proxy``\n\n``force`` will cause every link to have a proxy prefix regardless of\nwhether it 'should' (i.e. whether the LibGuides Database A-Z list has it\nset to not be proxied)\n\n``no_proxy`` will do the opposite and force the link to have no proxy\nprefix, useful for checking for dead links which will still be dead when\nproxied (and which might give false negatives if a link is dead and\nproxied)\n\n\n**-c, --config-file**\n\nUse a JSON config file rather than one of the Python options for config\nfiles. Arg just takes the path (relative, absolute, or relative to home)\nof the .json file you want to use.\n\n\n**-s, --save-config**\n\nTo be used in conjunction with ``-c``, will save the config file you\nused so that you don't have to provide the path to it every time. This\nsaved config will trump everything.\n\n\n**--flush-config**\n\nFlush any saved JSON configuration and use either a Python or new JSON\nconfiguration. Can be used on the same call as\n``-c new_json_config.json``.\n\n##Example Calls\n\nBasic call to check link status on the OCLC Knowledge Base collection\ndefined in your configuration.\n\n``check_ezproxy -u oclc -t link``\n\nCall with a JSON config that we are saving.\n\n``check_ezproxy --config=./config.json -s``\n\nCheck set OCLC knowledge base collection with an updated config.json (you can combine flags, but any flag that takes an argument must be the last one, and you can only have 1 of these when combining)\n\n``check_ezproxy --flush-config -sc ./config.json``\n\n##Add New Url Sources or types of checks\n\n\nimport the 'register' decorator from registration.py.\n\n###For a new Url source\n\nWrite a function that returns an iterable (i.e. list or tuple) of\nclasses or named tuples with a url and name element. Named tuple can be\nused like so:\n\n```python\nfrom collections import namedtuple\nRecord = namedtuple('Record', 'name url')\nnew_record = Record('this_name', 'http://www.example.com')\nprint(new_record.name) # will output 'this_name'\n```\n\nDecorate that function with the register decorator that takes what you\nwant the argument to be called in the command line script and 'places'\n\n```python\nfrom registration import register\n\n@register('get_links_here', 'places')\ndef get_links_here():\n return [list_of_record_named_tuples]\n```\n\nSave that file to the same directory as the rest of the scripts, import\nit in check proxy, and it should automatically be available in the\ncommand line script.\n\n###For a new type of check\n\nDo the same thing as for a url source above, except the second argument\nto the decorator should be 'checks' and your function should take a\ndatabase argument and a config argument, run some kind of check, and\nreturn that object if everything is fine and an object with name, url,\nand a new status attribute if something went wrong.\n\n```python\nfrom registration import register\n@register('check_em_good', 'checks')\ndef check_em_good(db):\n check(db)\n return db\n```\n\nYou can also just add the check to the checks.py or places.py files and\n(optionally) make a pull request to bring your checks into the main\nrepository.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/chill17/check_ezproxy/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "check-ezproxy", "package_url": "https://pypi.org/project/check-ezproxy/", "platform": "", "project_url": "https://pypi.org/project/check-ezproxy/", "project_urls": { "Homepage": "https://github.com/chill17/check_ezproxy/" }, "release_url": "https://pypi.org/project/check-ezproxy/0.2.1/", "requires_dist": null, "requires_python": "", "summary": "Command line tool to test EZProxy stanza configurations and link health.", "version": "0.2.1" }, "last_serial": 4140729, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "010ce48523d81e75e9f85edb8d3d8737", "sha256": "728aeec3716544af4ae5f8ecd3d1686ba86c3ffff9ebf2cac55ff54655b41130" }, "downloads": -1, "filename": "check_ezproxy-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "010ce48523d81e75e9f85edb8d3d8737", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15308, "upload_time": "2017-08-14T16:04:19", "url": "https://files.pythonhosted.org/packages/79/04/718658b87782cb1595c5a3827c33a025650ac8654e8981ab37265eb59331/check_ezproxy-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5b9b7be053442bfa9a877b9daa29c3e7", "sha256": "7067aac285cf60b8524a11d85234fd8ebf787e42e132929261a0331fd8548855" }, "downloads": -1, "filename": "check_ezproxy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5b9b7be053442bfa9a877b9daa29c3e7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8805, "upload_time": "2017-08-14T16:04:20", "url": "https://files.pythonhosted.org/packages/b7/95/50fafd525e4cb23df3af1a78efc8913faca9687ccf4513eac1c9f4c586b7/check_ezproxy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "4b07abf6231e33c4290c295e777b378c", "sha256": "bdabe28fbeb5a915964c3cd76f7694969e18e8a3eb6fe02567d8a751258aa858" }, "downloads": -1, "filename": "check_ezproxy-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4b07abf6231e33c4290c295e777b378c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16293, "upload_time": "2017-08-14T20:49:17", "url": "https://files.pythonhosted.org/packages/9f/e1/db62ea5dedc29221822fd7eaf40cdf390ef516bafa1f3ffabb55cf859726/check_ezproxy-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "211c4fe278775f36f2c8dd9827bbc508", "sha256": "eb8c29234811fc56afefbec3383682d72b8c0b95c5b26a45f0f3fcf2fd468b1b" }, "downloads": -1, "filename": "check_ezproxy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "211c4fe278775f36f2c8dd9827bbc508", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9785, "upload_time": "2017-08-14T20:49:18", "url": "https://files.pythonhosted.org/packages/e4/b4/bd55dc6359f17a82bab13f11fc2d9dfe64fba4f0ad2fe263a1e61ff167e7/check_ezproxy-0.1.1.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "6700c08767aa5e6ebc96d62d4b73a77a", "sha256": "b7faf3db545c5d12b78ae5dac50c8b655b966221320c74b3b78ef741e0859eaf" }, "downloads": -1, "filename": "check_ezproxy-0.2.1.tar.gz", "has_sig": false, "md5_digest": "6700c08767aa5e6ebc96d62d4b73a77a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9757, "upload_time": "2018-08-06T14:56:27", "url": "https://files.pythonhosted.org/packages/c7/07/9281785d9047de1880ae400281e7950fa6809c27060b374c1697c5569afd/check_ezproxy-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6700c08767aa5e6ebc96d62d4b73a77a", "sha256": "b7faf3db545c5d12b78ae5dac50c8b655b966221320c74b3b78ef741e0859eaf" }, "downloads": -1, "filename": "check_ezproxy-0.2.1.tar.gz", "has_sig": false, "md5_digest": "6700c08767aa5e6ebc96d62d4b73a77a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9757, "upload_time": "2018-08-06T14:56:27", "url": "https://files.pythonhosted.org/packages/c7/07/9281785d9047de1880ae400281e7950fa6809c27060b374c1697c5569afd/check_ezproxy-0.2.1.tar.gz" } ] }