{ "info": { "author": "Javier Llopis", "author_email": "javier@llopis.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: End Users/Desktop", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3.7", "Topic :: Internet", "Topic :: Office/Business", "Topic :: System", "Topic :: System :: Monitoring", "Topic :: System :: Networking :: Monitoring", "Topic :: Utilities" ], "description": "## UrlMonitor\n\nThis program is intended to be run periodically from cron or a systemd ``.timer`` service on GNU/Linux, a Periodic Task on Windows, or whatever you are using.\n\nWhen run, the program will check the URLs from its list, and, if they have changed since the last time they were checked, will run a series of actions as a result.\n\nThe list of URLs and actions to be run if changed are specified in a YAML file (by default called ``urllist.yml``). This file consist on a LIST of OBJECTS, each containing the fields name with a descriptive string, url with the url to be checked, and actions, which is a LIST of OBJECTS, where the key is the action name and the value are the arguments, which can be a STRING or a LIST of strings.\n\nAn example of urllist.yml file:\n\n```yaml\n---\n- name: Check for new versions of my favourite software\n url: https://www.coolproject.org/download/files\n actions:\n - email_notify:\n - joe@domain.com\n - jill@somewhere.else.com\n\n- name: Get latest version of the software\n url: https://www.coolproject.org/latest\n actions:\n - re_match:\n - '[Ss]ource [Tt]arball.*The file'\n - run_script: wget {re_match[1]}\n```\nThis action sets the following variables:\n\nVariable | Value\n------------|-----------------------------------\nreturn_code | The exit code of the program\nerror | The error encountered, if any\nstdout | Whatever the program has written to its standard output\nstderr | Whatever the program has written to its error output\n\n\n### Writing Custom Actions\nYou can write a custom action easily. You just need to write a Python module that exports a callable called ``action_object`` with the following signature:\n\n```python\ndef action_object(name, arglst, url, content, variables, log):\n pass\n```\n\nWhere the arguments are:\n\nArgument | Description\n----------|--------\nname | The action name\narglst | The list of arguments.\nurl | The url that changed\ncontent | The content (possibly HTML) of the url\nvariables | A mapping containing the variables and their values\nlog | A logging object\n\nIf the arguments in ``arglst`` will be expanded by the calling routine and should contain the final value.\n\nIf your action requires configuration parameters, you can create a class that has a ``__call__`` method and instantiate into ``action_object``. At configuration time, the program will call the ``initialise`` method with a dictionary containing the configuration parameters as argument.\n\nIn order to simplify the process, the module ``actionbase`` provides the class ``Action`` from which your action can inherit. This already provides an ``initialise`` method which will install the configuration parameters, which you can access as instance attributes of ``action_object``. In addition, you should provide a list of expected parameters and a default value for those that can have one in the class variables ``check_cfg_vars`` and ``default_vars``. An exception is raised if a parameter that has been specified in ``check_cfg_vars`` is not found and there is no default value.\n\nAs an example, you can check the code for the ``email_notify`` action.\n\n```python\nfrom urlmonitor.actionbase import Action\n\nclass _EmailAction(Action):\n\n check_cfg_vars = [ \"smtp_server\", \"from_address\", \"smtp_encryption\",\n \"smtp_user\", \"smtp_password\", \"smtp_port\"]\n default_vars = {\n \"from_address\": \"urlmonitor@{}\".format(_NODE),\n \"smtp_encryption\": None,\n \"smtp_user\": None,\n \"smtp_password\": \"\",\n \"smtp_port\": 0,\n }\n\n ...\n\n def __call__(self, name, arglst, url, content, variables, log):\n ...\n \naction_object = _EmailAction()\n```\n\n\n### License\n\nThis software is released under the **MIT License**", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/destrangis/urlmonitor", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "urlmonitor", "package_url": "https://pypi.org/project/urlmonitor/", "platform": "", "project_url": "https://pypi.org/project/urlmonitor/", "project_urls": { "Homepage": "https://github.com/destrangis/urlmonitor" }, "release_url": "https://pypi.org/project/urlmonitor/0.0.8/", "requires_dist": null, "requires_python": "", "summary": "Check url and run actions if changed", "version": "0.0.8" }, "last_serial": 5958860, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "5d23b035db08fe02b2fdb3900718c29a", "sha256": "0a57bc7d650ad69a5bea8f225a519cb207af9d948c9f7d243ac0b528a6115b29" }, "downloads": -1, "filename": "urlmonitor-0.0.4.tar.gz", "has_sig": false, "md5_digest": "5d23b035db08fe02b2fdb3900718c29a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17753, "upload_time": "2019-05-26T19:44:21", "url": "https://files.pythonhosted.org/packages/6c/d1/5480daed713e68b54b23ebcca720995bcb97bc85b1ca02f9b0892eac0eb1/urlmonitor-0.0.4.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "7d0f9d764808a4636015de94dd777b9a", "sha256": "810277b5b9c2a3746ca7ef2704679f2c9b2f0f1fe742ccf7adeeffe503d58ddd" }, "downloads": -1, "filename": "urlmonitor-0.0.8.tar.gz", "has_sig": false, "md5_digest": "7d0f9d764808a4636015de94dd777b9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17799, "upload_time": "2019-10-11T07:50:43", "url": "https://files.pythonhosted.org/packages/2b/a5/6af81eb046edc29f785641cdc476cd98d70f5b16d5e8232dea81c6faf285/urlmonitor-0.0.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7d0f9d764808a4636015de94dd777b9a", "sha256": "810277b5b9c2a3746ca7ef2704679f2c9b2f0f1fe742ccf7adeeffe503d58ddd" }, "downloads": -1, "filename": "urlmonitor-0.0.8.tar.gz", "has_sig": false, "md5_digest": "7d0f9d764808a4636015de94dd777b9a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17799, "upload_time": "2019-10-11T07:50:43", "url": "https://files.pythonhosted.org/packages/2b/a5/6af81eb046edc29f785641cdc476cd98d70f5b16d5e8232dea81c6faf285/urlmonitor-0.0.8.tar.gz" } ] }