{ "info": { "author": "Bernhard Posselt", "author_email": "dev@bernhard-posselt.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only", "Topic :: Utilities" ], "description": "Nextcloud News Updater\n======================\n\n.. image:: https://img.shields.io/pypi/v/nextcloud_news_updater.svg\n :target: https://pypi.python.org/pypi/nextcloud_news_updater\n.. image:: https://travis-ci.org/nextcloud/news-updater.svg?branch=master\n :target: https://travis-ci.org/nextcloud/news-updater\n\nThis Python library is a parallel feed updater for the `Nextcloud News app `_\n\n\nNextcloud does not require people to install threading or multiprocessing\nlibraries. Because the feed update process is mainly limited by I/O, parallel\nfetching of RSS feed updates can speed up the updating process significantly.\n\nIn addition, Web Cron is not a supported cron setting since the update\nprocess may time out.\n\nTherefore the News app provides an API that offers a more fine grained\ncontrol over updating feeds. This Python project implements an update\nmechanism that is based on the `updater REST API `_ or (new in Nextcloud News 8.1.0) the\nconsole based update API.\n\n.. contents:: :local:\n\nDependencies\n------------\n\n* **Python >=3.5**\n\nPre-Installation\n----------------\n\nTo run the updates via an external threaded script the cron updater has to be\ndisabled. To do that go to the admin section an uncheck the **Use Nextcloud\ncron** checkbox or open **nextcloud/data/news/config/config.ini** and set::\n\n useCronUpdates = true\n\nto::\n\n useCronUpdates = false\n\nInstallation\n------------\nThere are two different ways to install the updater:\n\n* Installation using pip (recommended)\n* Manual installation\n* No installation\n\nInstallation Using Pip\n~~~~~~~~~~~~~~~~~~~~~~\nSince 8.2 the package is available on pypi for installation via pip (the\nPython library package manager).\n\nTo install pip on your distribution of choice, `consolidate the pip\ndocumentation `_\n\n**Note**: You need to install the Python 3 version of pip\n\nAfter installing pip, run::\n\n sudo pip3 install nextcloud_news_updater --install-option=\"--install-scripts=/usr/bin\"\n\nTo update the library, run::\n\n sudo pip3 install --upgrade nextcloud_news_updater --install-option=\"--install-scripts=/usr/bin\"\n\nTo uninstall the library run::\n\n sudo pip3 uninstall nextcloud_news_updater\n\nManual Installation\n~~~~~~~~~~~~~~~~~~~\nIf you don't want to install the updater via pip, you can install it manually.\nThis requires setuptools to be installed. On Ubuntu this can be done by running::\n\n sudo apt-get install python3-setuptools\n\nThen install the package like this::\n\n python3 setup.py install --install-scripts=/usr/bin\n\nTo uninstall the updater run::\n\n python3 setup.py uninstall\n\nNo Installation\n~~~~~~~~~~~~~~~\nIf you do not want to install the script at all you can call it directly.\n\nSimply run the updater using::\n\n python3 -m nextcloud_news_updater /path/to/nextcloud\n\nUsage\n-----\n\nThere are two ways to run the updater:\n\n* Using the console API (recommended)::\n\n nextcloud-news-updater /path/to/nextcloud\n\n* Using the REST API (when running the updater on a different machine than Nextcloud)::\n\n nextcloud-news-updater https://domain.com/path/to/nextcloud --user admin_user --password admin_password\n\n**Note**: **admin_user** is a user id with admin rights, **admin_password** the user's password\n\nYou can view all options by running::\n\n nextcloud-news-updater --help\n\n::\n\n usage: nextcloud-news-updater [-h] [--threads THREADS] [--timeout TIMEOUT]\n [--interval INTERVAL] [--apilevel {v1-2,v2}]\n [--loglevel {info,error}] [--config CONFIG]\n [--phpini PHPINI] [--user USER] [--password PASSWORD]\n [--version] [--mode {endless,singlerun}] [--php PHP]\n [url]\n\n positional arguments:\n url The URL or absolute path to the directory where\n Nextcloud is installed. Must be specified on the\n command line or in the config file. If the URL starts\n with http:// or https://, a user and password are\n required. Otherwise the updater tries to use the\n console based API which was added in 8.1.0\n\n optional arguments:\n -h, --help show this help message and exit\n --threads THREADS, -t THREADS\n How many feeds should be fetched in parallel, defaults\n to 10\n --timeout TIMEOUT, -s TIMEOUT\n Maximum number of seconds for updating a feed,\n defaults to 5 minutes\n --interval INTERVAL, -i INTERVAL\n Update interval between fetching the next round of\n updates in seconds, defaults to 15 minutes. The update\n timespan will be subtracted from the interval.\n --apilevel {v1-2,v2}, -a {v1-2,v2}\n API level. Use v1-2, v2 is currently a draft only\n --loglevel {info,error}, -l {info,error}\n Log granularity, info will log all urls and received\n data, error will only log errors\n --config CONFIG, -c CONFIG\n Path to config file where all parameters except can be\n defined as key values pair. An example is in\n bin/example_config.ini\n --phpini PHPINI, -P PHPINI\n Custom absolute path to the php.ini file to use for\n the command line updater. If omitted, the default one\n will be used\n --user USER, -u USER Admin username to log into Nextcloud. Must be\n specified on the command line or in the config file if\n the updater should update over HTTP\n --password PASSWORD, -p PASSWORD\n Admin password to log into Nextcloud if the updater\n should update over HTTP\n --version, -v Prints the updater's version\n --mode {endless,singlerun}, -m {endless,singlerun}\n Mode to run the updater in: endless runs the update\n again after the specified interval, singlerun only\n executes the update once\n --php PHP Path to the PHP binary, e.g. /usr/bin/php7.0, defaults\n to php\n\n\n\n\nYou can also put your settings in a config file, looking like this:\n\n.. code:: ini\n\n [updater]\n # only needed when using the REST API\n user = admin\n # only needed when using the REST API\n password = admin\n threads = 10\n interval = 900\n loglevel = error\n # or https://domain.com/nextcloud when using the REST API\n url = /path/to/nextcloud\n phpini = /path/to/custom/php.ini\n # or v2 which is currently a draft\n apilevel = v1-2\n mode = endless\n # path to php binary\n php = /usr/bin/php7.0\n\n**Note**: You can omit options in the config file if you want to use the defaults, but you can not have more than the allowed parameters present, otherwise an exception will abort the updater.\n\nThen run the updater with::\n\n nextcloud-news-updater -c /path/to/config\n\n\n**Note**: Command line parameters will always overwrite config parameters, so if you just want to change your loglevel to info for one run you can now do the following without globally changing the config file::\n\n nextcloud-news-updater -c /path/to/config --mode singlerun --loglevel info\n\nRunning The Updater As Systemd Service\n--------------------------------------\nAlmost always you want to run and stop the updater using your in init system.\nAs for Systemd, you can create a simple text file at\n**/etc/systemd/system/nextcloud-news-updater.service** with the following contents:\n\n.. code:: ini\n\n [Unit]\n After=default.target\n\n [Service]\n Type=simple\n User=http\n ExecStart=/usr/bin/nextcloud-news-updater -c /etc/nextcloud/news/updater.ini\n\n [Install]\n WantedBy=default.target\n\nThen to enable and start it run::\n\n sudo systemctl enable nextcloud-news-updater.service\n sudo systemctl start nextcloud-news-updater.service\n\n**Note**: If you are using the cli based updater (as in set an absolute directory as url)\nyou need to set the web-server user as user in the unit file. Otherwise the command\nwill fail because Nextcloud checks for the owner of its files. This user\nvaries from distribution to distribution, e.g in Debian and Ubuntu you would use the\n**www-data** user:\n\n.. code:: ini\n\n [Unit]\n After=default.target\n\n [Service]\n Type=simple\n User=www-data\n ExecStart=/usr/bin/nextcloud-news-updater -c /etc/nextcloud/news/updater.ini\n\n [Install]\n WantedBy=default.target\n\nIf you are using the REST API, most of the time you can get away by using **nobody** as\nuser, but again, that might vary depending on your distribution.\n\nTroubleshooting\n----------------\nIf you are having trouble debugging updater errors, try running it again using the **info** loglevel::\n\n nextcloud-news-updater --loglevel info -c /path/to/config.ini\n\nHow Do I Enable Support For Self-Signed Certificates\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIf you are using self-signed certificates, don't. It's very easy to sign your cert for free from either one of the following three websites:\n\n* `Lets Encrypt `_\n* `StartSSL `_\n* `WoSign `_\n\nIf you still have to use a self-signed certificate no matter what, don't patch the code to turn off certificate verification but rather globally add your certificate to the trusted certificates. Read up on your distributions documentation to find out how.\n\nCan I Run The Updater Using Cron\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nYes, you can by using the **--mode singlerun** parameter which will exit after one full update.\n\nHowever it's your job to ensure, that the job will not be executed more than once at the same time. If update jobs overlap, they **can take down your system and/or server** since each new updater will slow down the previous ones causing more updaters to be spawned.\n\nIf you can not ensure that the updater is run only one at a time use the default mode (**--mode endless**). This mode runs the update in a loop. You can control the update frequency through the **--interval** parameter (or **interval** using a config file). The updater works in the following way:\n* If a full update takes longer than the passed interval, another update will be run immediately afterwards\n* If a full update took less than the passed interval, the updater will sleep for the remaining time and run an update afterwards\n\n\nUsing The CLI Based Updater Fails\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe updater uses the PHP executable to run the occ file inside your nextcloud directory. The general process boils down to the following:\n\n.. code-block:: bash\n\n # delete folders and feeds marked for deletion\n php -f /home/bernhard/programming/core/occ news:updater:before-update\n\n # get all feeds to udpate\n php -f /home/bernhard/programming/core/occ news:updater:all-feeds\n\n # run all feed updates\n php -f /home/bernhard/programming/core/occ news:updater:update-feed FEED_ID USER_ID\n\n # delete old articles\n php -f /home/bernhard/programming/core/occ news:updater:after-update\n\nMost of the time there are two possible points of failure that can be debugged by using the **--logelevel info** parameter:\n\n\n* Most distributions uses different **php.ini** files for your command line and web-server. This can manifest itself in weird errors like not being able to connect to the database. The solution is to either adjust **php.ini** used for the CLI PHP or to use a different **php.ini** altogether by specifying the **--phpini** parameter, e.g.::\n\n nextcloud-news-updater -c /path/to/config --phpini /etc/php/nextcloud-news-updater.ini\n\n* The **news:updater:all-feeds** command returns invalid JSON. This can be due to due broken or missing **php.ini** settings or PHP warnings/errors produced by Nextcloud. The solution to this issue can range from adjusting your **php.ini** (see previous point) to manually patching Nextcloud to remove the warnings from the output.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nextcloud/news-updater", "keywords": "nextcloud", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "nextcloud_news_updater", "package_url": "https://pypi.org/project/nextcloud_news_updater/", "platform": "", "project_url": "https://pypi.org/project/nextcloud_news_updater/", "project_urls": { "Homepage": "https://github.com/nextcloud/news-updater" }, "release_url": "https://pypi.org/project/nextcloud_news_updater/10.0.1/", "requires_dist": null, "requires_python": "", "summary": "Nextcloud News updater - Fast updates for your RSS/Atom feeds", "version": "10.0.1" }, "last_serial": 3471831, "releases": { "10.0.0": [ { "comment_text": "", "digests": { "md5": "3a5be2907324e2c84cf1c6289a0a5262", "sha256": "40226a2d2a168988ba40050c5b235c8d1745fa03559b557df0206872c167fa02" }, "downloads": -1, "filename": "nextcloud_news_updater-10.0.0.tar.gz", "has_sig": false, "md5_digest": "3a5be2907324e2c84cf1c6289a0a5262", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33153, "upload_time": "2017-07-06T15:39:52", "url": "https://files.pythonhosted.org/packages/dc/d0/af3e3eb52536ae645ae961f87259c3739cac9d784bf91a80d7ff309c1b96/nextcloud_news_updater-10.0.0.tar.gz" } ], "10.0.1": [ { "comment_text": "", "digests": { "md5": "542823b95554b2fc50993cdc159bdd85", "sha256": "d87cd0026e3f3ab1b0318cbc2422b26e1b0d1640a9911167a8daf113081f5292" }, "downloads": -1, "filename": "nextcloud_news_updater-10.0.1.tar.gz", "has_sig": false, "md5_digest": "542823b95554b2fc50993cdc159bdd85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32760, "upload_time": "2018-01-08T18:16:21", "url": "https://files.pythonhosted.org/packages/53/15/f395d8aa11e3592cd716a09fb641cbe7858ac3220bf06b3123027ca9a26a/nextcloud_news_updater-10.0.1.tar.gz" } ], "9.0.2": [ { "comment_text": "", "digests": { "md5": "89935837b39ae278bae47e37d62d6967", "sha256": "9caa7372e358bb0adc030ae7c41e5359807855a23c92289da072fb1f5221cfd4" }, "downloads": -1, "filename": "nextcloud_news_updater-9.0.2.tar.gz", "has_sig": false, "md5_digest": "89935837b39ae278bae47e37d62d6967", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33005, "upload_time": "2016-08-21T07:39:20", "url": "https://files.pythonhosted.org/packages/ce/b1/36346bb57b5d6bcf78fc4585a1929c1b92cafc674c146df54a2940037ad9/nextcloud_news_updater-9.0.2.tar.gz" } ], "9.0.3": [ { "comment_text": "", "digests": { "md5": "19239eb0e77c2611823c474a0dedeecf", "sha256": "b4d455bd6cc4e66dcee20394f39e15b0b60217b7aedeb92aa76b4a525587b52d" }, "downloads": -1, "filename": "nextcloud_news_updater-9.0.3.tar.gz", "has_sig": false, "md5_digest": "19239eb0e77c2611823c474a0dedeecf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 33158, "upload_time": "2017-07-06T15:39:16", "url": "https://files.pythonhosted.org/packages/86/a5/d49877874359e60c9963e28b8d684a68ab70f8fd7a55187e1a7dc65e7195/nextcloud_news_updater-9.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "542823b95554b2fc50993cdc159bdd85", "sha256": "d87cd0026e3f3ab1b0318cbc2422b26e1b0d1640a9911167a8daf113081f5292" }, "downloads": -1, "filename": "nextcloud_news_updater-10.0.1.tar.gz", "has_sig": false, "md5_digest": "542823b95554b2fc50993cdc159bdd85", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32760, "upload_time": "2018-01-08T18:16:21", "url": "https://files.pythonhosted.org/packages/53/15/f395d8aa11e3592cd716a09fb641cbe7858ac3220bf06b3123027ca9a26a/nextcloud_news_updater-10.0.1.tar.gz" } ] }