### Install Morss Python Package (Simple) Source: https://github.com/pictuga/morss/blob/master/README.md Install the Morss Python package with only in-memory cache available. This method does not include optional dependencies like `lxml` or `gunicorn`. ```Shell pip install morss ``` ```Shell pip install git+https://git.pictuga.com/pictuga/morss.git ``` -------------------------------- ### Run Morss with Docker Compose Source: https://github.com/pictuga/morss/blob/master/README.md This command starts Morss using a `docker-compose.yml` file, which is the recommended method for managing multi-container Docker applications. ```shell docker-compose up ``` -------------------------------- ### Deploy Morss with Cloud-init on Ubuntu Source: https://github.com/pictuga/morss/blob/master/README.md This YAML configuration sets up a Ubuntu instance for Morss deployment, installing necessary Python packages, configuring environment variables for debugging and caching, and setting up a per-boot script to run the Morss daemon. It's suitable for cloud providers supporting `cloud-init`. ```yml #cloud-config packages: - python3-pip - python3-wheel - python3-lxml - python3-setproctitle - ca-certificates write_files: - path: /etc/environment append: true content: | DEBUG=1 CACHE=diskcache CACHE_SIZE=1073741824 # 1GiB - path: /var/lib/cloud/scripts/per-boot/morss.sh permissions: 744 content: | #!/bin/sh /usr/local/bin/morss-helper daemon runcmd: - source /etc/environment - update-ca-certificates - iptables -I INPUT 6 -m state --state NEW -p tcp --dport ${PORT:-8000} -j ACCEPT - netfilter-persistent save - pip install morss[full] ``` -------------------------------- ### Install Morss Python Package (Full) Source: https://github.com/pictuga/morss/blob/master/README.md Install the Morss Python package with all optional dependencies, including various cache backends and `gunicorn` for efficient HTTP handling. This provides the full feature set of Morss. ```Shell pip install morss[full] ``` ```Shell pip install git+https://git.pictuga.com/pictuga/morss.git#egg=morss[full] ``` -------------------------------- ### Run Morss with Gunicorn Source: https://github.com/pictuga/morss/blob/master/README.md This command starts the Morss application using Gunicorn, a Python WSGI HTTP server, with the `--preload` option. Gunicorn is recommended for better performance in production environments. ```shell gunicorn --preload morss ``` -------------------------------- ### Run Morss as a CLI Application Source: https://github.com/pictuga/morss/blob/master/README.md This command demonstrates how to use Morss as a command-line tool, allowing users to pass arguments and a feed URL directly. ```shell morss [--argwithoutvalue] [--argwithvalue=value] [...] FEEDURL ``` -------------------------------- ### Run Morss with uWSGI Source: https://github.com/pictuga/morss/blob/master/README.md This command runs Morss using uWSGI, a fast application server, serving it via HTTP on port 8000 and loading `main.py` as the WSGI application. ```shell uwsgi --http :8000 --plugin python --wsgi-file main.py ``` -------------------------------- ### Process RSS Feed with Caching and Options in morss Source: https://github.com/pictuga/morss/blob/master/README.md Illustrates how to use `morss.process` with a specified cache location and additional options. This example shows how to enable CSV output and store cached data. ```python >>> import morss >>> url = 'http://feeds.bbci.co.uk/news/rss.xml' >>> cache = '/tmp/morss-cache' # diskcache cache location >>> options = {'csv':True} >>> xml_string = morss.process(url, cache, options) >>> xml_string[:50] '{"title": "BBC News - Home", "desc": "The latest s' ``` -------------------------------- ### Run Morss with Docker Compose (Recommended) Source: https://github.com/pictuga/morss/blob/master/README.md Configure and run Morss using Docker Compose, which is the recommended method for deployment. This snippet defines a service that exposes Morss on port 8000. ```YAML services: app: image: pictuga/morss ports: - '8000:8000' ``` -------------------------------- ### Run Morss with Internal HTTP Server Source: https://github.com/pictuga/morss/blob/master/README.md This command starts Morss using its built-in, basic HTTP server, primarily for debugging purposes. It defaults to port 8000, which can be overridden by the `PORT` environment variable. ```shell morss ``` ```shell PORT=9000 morss ``` -------------------------------- ### Retrieve Full-Text RSS Feed with morss.process Source: https://github.com/pictuga/morss/blob/master/README.md Demonstrates how to quickly fetch and process a full-text RSS feed using the `morss.process` function. It shows a basic import and usage, returning an XML string. ```python >>> import morss >>> xml_string = morss.process('http://feeds.bbci.co.uk/news/rss.xml') >>> xml_string[:50] "\n tag to instruct the client browser to redirect to a specified URL after a 2-second delay, serving as a client-side redirection mechanism. ```HTTP HTTP/1.1 200 OK content-type: text/html; charset=UTF-8
meta redirect ``` -------------------------------- ### morss Command Line Interface (CLI) Arguments Source: https://github.com/pictuga/morss/blob/master/README.md Documents the various command-line arguments available for the `morss` utility. It details options for input, output formatting, actions, custom feed parsing, and miscellaneous settings, providing a comprehensive reference for CLI usage. ```APIDOC usage: morss [-h] [--post STRING] [--xpath XPATH] [--format {rss,json,html,csv}] [--search STRING] [--clip] [--indent] [--cache] [--force] [--proxy] [--order {first,last,newest,oldest}] [--firstlink] [--resolve] [--items XPATH] [--item_link XPATH] [--item_title XPATH] [--item_content XPATH] [--item_time XPATH] [--mode {xml,html,json}] [--nolink] [--noref] [--silent] url Get full-text RSS feeds positional arguments: url feed url options: -h, --help show this help message and exit --post STRING POST request --xpath XPATH xpath rule to manually detect the article output: --format {rss,json,html,csv} output format --search STRING does a basic case-sensitive search in the feed --clip stick the full article content under the original feed content (useful for twitter) --indent returns indented XML or JSON, takes more place, but human-readable action: --cache only take articles from the cache (ie. don't grab new articles' content), so as to save time --force force refetch the rss feed and articles --proxy doesn't fill the articles --order {first,last,newest,oldest} order in which to process items (which are however NOT sorted in the output) --firstlink pull the first article mentioned in the description instead of the default link --resolve replace tracking links with direct links to articles (not compatible with --proxy) custom feeds: --items XPATH (mandatory to activate the custom feeds function) xpath rule to match all the RSS entries --item_link XPATH xpath rule relative to items to point to the entry's link --item_title XPATH entry's title --item_content XPATH entry's content --item_time XPATH entry's date & time (accepts a wide range of time formats) --mode {xml,html,json} parser to use for the custom feeds misc: --nolink drop links, but keeps links' inner text --noref drop items' link --silent don't output the final RSS (useless on its own, but can be nice when debugging) ``` -------------------------------- ### HTML Meta Refresh for Client-Side Redirection Source: https://github.com/pictuga/morss/blob/master/tests/samples/meta-redirect-rel.txt This HTML snippet shows how to implement a client-side redirect using the tag. The content attribute specifies the delay in seconds before redirection and the target URL. ```HTML meta redirect ``` -------------------------------- ### Morss Server URL Structure Source: https://github.com/pictuga/morss/blob/master/README.md This defines the URL pattern for accessing Morss when running as a server. It shows how to specify optional arguments and the feed URL, with `main.py` being optional depending on server configuration. ```APIDOC http://PATH/TO/MORSS/[main.py/][:argwithoutvalue[:argwithvalue=value[...]]]/FEEDURL For example: http://morss.example/:clip/https://twitter.com/pictuga ``` -------------------------------- ### Setting Morss Environment Variables Across Platforms Source: https://github.com/pictuga/morss/blob/master/README.md This snippet demonstrates various methods for setting environment variables for the Morss application across different deployment environments, including Docker CLI, Docker Compose, Gunicorn/uWSGI/CLI, Apache, and cloud-init. ```bash docker run -p 8000:8000 morss --env KEY=value ``` ```yaml services: morss: image: your_morss_image environment: - KEY=value - ANOTHER_KEY=another_value ``` ```bash KEY=value ANOTHER_KEY=another_value gunicorn morss_app:app ``` ```apacheconf!DESC!