saltimbanque


Namesaltimbanque JSON
Version 1.2.1 PyPI version JSON
download
home_pageNone
SummaryProvides an API to convert web pages to PDF
upload_time2024-09-02 07:38:03
maintainerFabien LOISON
docs_urlNone
authorWanadev
requires_pythonNone
licenseAGPLv3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Saltimbanque
============

|Github| |Discord| |PYPI Version| |Build Status| |Black| |License|

Provides a simple Web API to convert web pages to PDF and PNG using WeasyPrint_.

.. _WeasyPrint: https://weasyprint.org/


Dependencies
------------

* Flask
* WeasyPrint


Install
-------

Ensure you have a complete Python 3 installation. On Debian / Ubuntu, run (as root)::

    apt install build-essential python3 python3-dev python3-venv

Then, to install Saltimbanque from PyPI, run (as root)::

    mkdir -p /opt/saltimbanque
    python3 -m venv /opt/saltimbanque/env
    /opt/saltimbanque/env/bin/pip install saltimbanque gunicorn

Alternatively, to install it from Git, run (as root)::

    mkdir -p /opt/saltimbanque
    git clone https://github.com/wanadev/saltimbanque.git /opt/saltimbanque/saltimbanque.git
    python3 -m venv /opt/saltimbanque/env
    /opt/saltimbanque/env/bin/pip install gunicorn
    /opt/saltimbanque/env/bin/pip install -e /opt/saltimbanque/saltimbanque.git

NOTE: If you need the export webpage to PNG, you should install an older WeasyPrint version::

    /opt/saltimbanque/env/bin/pip install weasyprint==52.5


Usage
-----

To run Saltimbanque::

    /opt/saltimbanque/env/bin/gunicorn -w 4 saltimbanque:app

By default it will listen to port 8000. To run it on an other port::

    /opt/saltimbanque/env/bin/gunicorn -w 4 -b 127.0.0.1:8888 saltimbanque:app

Important notes:

* It is recommanded to use supervisor or systemd to start the Saltimbanque server.
* You should also consider to setup a proxy server like Nginx in front of Gunicorn.

You can now open the Saltimbanque root route in your browser to access a demo web page:

* http://localhost:8000/


API
---

To build a PDF from a web page::

    http://localhost:8000/html-to-pdf/<string:base64_url>

To build a PNG from a web page::

    http://localhost:8000/html-to-png/<string:base64_url>

Where:

* ``base64_url`` is the URL of the HTML document, encoded in base64.


NOTE: ``html-to-png`` is no more available since WeasyPrint 53. You should install an older WeasyPrint version if you need this feature. For more information see https://www.courtbouillon.org/blog/00008-weasyprint-53-beta/ .


Contributing
------------

Questions
~~~~~~~~~

If you have any question, you can:

* `Open an issue <https://github.com/wanadev/saltimbanque/issues>`__ on GitHub
* `Ask on Discord <https://discord.gg/BmUkEdMuFp>`__


Bugs
~~~~

Please `open an issue <https://github.com/wanadev/saltimbanque/issues>`__ on GitHub with as much information as possible if you found a bug:

* Your operating system / Linux distribution (and its version)
* How you installed the software
* All the logs and message outputted by the software
* etc.


Pull requests
~~~~~~~~~~~~~

Please consider `filing a bug <https://github.com/wanadev/saltimbanque/issues>`__ before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.

Please note that your code must follow the coding style defined by the `pep8 <https://pep8.org>`__. `Black <https://black.readthedocs.io/en/stable>`_ and `Flake8 <https://flake8.pycqa.org/en/latest>`__ are used on this project to enforce the coding style.


Lint the code
~~~~~~~~~~~~~

You must install `Nox <https://nox.thea.codes/>`__ first::

    pip install nox

Then you can check for lint error::

    nox --session lint

You can also fix coding style errors automatically with::

    nox -s black_fix


Setup / Run Saltimbanque for dev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Install dependencies::

    python3 -m venv __env__
    __env__/bin/pip install -e ".[dev]"

Run::

    __env__/bin/flask run


Changelog
---------

* **[NEXT]** (changes on ``master``, but not released yet):

  * Nothing yet ;)

* **v1.2.1:**

  * misc: Added missing AGPL license

* **v1.2.0:**

  * Fixes deployment
  * Updates dependencies
  * Adds PNG raster function in addition to PDF

* **v1.1.1:** Fix encoding issue when decoding URLs
* **v1.1.0:** Encode URL in base64 to avoid issue when used with an Nginx front
* **v1.0.1:** Update deploy config
* **v1.0.0:** Initial release


.. |Github| image:: https://img.shields.io/github/stars/wanadev/saltimbanque?label=Github&logo=github
   :target: https://github.com/wanadev/saltimbanque
.. |Discord| image:: https://img.shields.io/badge/chat-Discord-8c9eff?logo=discord&logoColor=ffffff
   :target: https://discord.gg/BmUkEdMuFp
.. |PYPI Version| image:: https://img.shields.io/pypi/v/saltimbanque.svg
   :target: https://pypi.python.org/pypi/saltimbanque
.. |Build Status| image:: https://github.com/wanadev/saltimbanque/actions/workflows/python-ci.yml/badge.svg
   :target: https://github.com/wanadev/saltimbanque/actions
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://black.readthedocs.io/en/stable/
.. |License| image:: https://img.shields.io/pypi/l/saltimbanque.svg
   :target: https://github.com/wanadev/saltimbanque/blob/master/COPYING

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "saltimbanque",
    "maintainer": "Fabien LOISON",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Wanadev",
    "author_email": "contact@wanadev.fr",
    "download_url": "https://files.pythonhosted.org/packages/a6/89/577515cbebcb6fc76bd2e9e8f2cca4306ca347b8fee85d35067d9c3eb333/saltimbanque-1.2.1.tar.gz",
    "platform": null,
    "description": "Saltimbanque\n============\n\n|Github| |Discord| |PYPI Version| |Build Status| |Black| |License|\n\nProvides a simple Web API to convert web pages to PDF and PNG using WeasyPrint_.\n\n.. _WeasyPrint: https://weasyprint.org/\n\n\nDependencies\n------------\n\n* Flask\n* WeasyPrint\n\n\nInstall\n-------\n\nEnsure you have a complete Python 3 installation. On Debian / Ubuntu, run (as root)::\n\n    apt install build-essential python3 python3-dev python3-venv\n\nThen, to install Saltimbanque from PyPI, run (as root)::\n\n    mkdir -p /opt/saltimbanque\n    python3 -m venv /opt/saltimbanque/env\n    /opt/saltimbanque/env/bin/pip install saltimbanque gunicorn\n\nAlternatively, to install it from Git, run (as root)::\n\n    mkdir -p /opt/saltimbanque\n    git clone https://github.com/wanadev/saltimbanque.git /opt/saltimbanque/saltimbanque.git\n    python3 -m venv /opt/saltimbanque/env\n    /opt/saltimbanque/env/bin/pip install gunicorn\n    /opt/saltimbanque/env/bin/pip install -e /opt/saltimbanque/saltimbanque.git\n\nNOTE: If you need the export webpage to PNG, you should install an older WeasyPrint version::\n\n    /opt/saltimbanque/env/bin/pip install weasyprint==52.5\n\n\nUsage\n-----\n\nTo run Saltimbanque::\n\n    /opt/saltimbanque/env/bin/gunicorn -w 4 saltimbanque:app\n\nBy default it will listen to port 8000. To run it on an other port::\n\n    /opt/saltimbanque/env/bin/gunicorn -w 4 -b 127.0.0.1:8888 saltimbanque:app\n\nImportant notes:\n\n* It is recommanded to use supervisor or systemd to start the Saltimbanque server.\n* You should also consider to setup a proxy server like Nginx in front of Gunicorn.\n\nYou can now open the Saltimbanque root route in your browser to access a demo web page:\n\n* http://localhost:8000/\n\n\nAPI\n---\n\nTo build a PDF from a web page::\n\n    http://localhost:8000/html-to-pdf/<string:base64_url>\n\nTo build a PNG from a web page::\n\n    http://localhost:8000/html-to-png/<string:base64_url>\n\nWhere:\n\n* ``base64_url`` is the URL of the HTML document, encoded in base64.\n\n\nNOTE: ``html-to-png`` is no more available since WeasyPrint 53. You should install an older WeasyPrint version if you need this feature. For more information see https://www.courtbouillon.org/blog/00008-weasyprint-53-beta/ .\n\n\nContributing\n------------\n\nQuestions\n~~~~~~~~~\n\nIf you have any question, you can:\n\n* `Open an issue <https://github.com/wanadev/saltimbanque/issues>`__ on GitHub\n* `Ask on Discord <https://discord.gg/BmUkEdMuFp>`__\n\n\nBugs\n~~~~\n\nPlease `open an issue <https://github.com/wanadev/saltimbanque/issues>`__ on GitHub with as much information as possible if you found a bug:\n\n* Your operating system\u00a0/ Linux distribution (and its version)\n* How you installed the software\n* All the logs and message outputted by the software\n* etc.\n\n\nPull requests\n~~~~~~~~~~~~~\n\nPlease consider `filing a bug <https://github.com/wanadev/saltimbanque/issues>`__ before starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.\n\nPlease note that your code must follow the coding style defined by the `pep8 <https://pep8.org>`__. `Black <https://black.readthedocs.io/en/stable>`_ and `Flake8 <https://flake8.pycqa.org/en/latest>`__ are used on this project to enforce the coding style.\n\n\nLint the code\n~~~~~~~~~~~~~\n\nYou must install `Nox <https://nox.thea.codes/>`__ first::\n\n    pip install nox\n\nThen you can check for lint error::\n\n    nox --session lint\n\nYou can also fix coding style errors automatically with::\n\n    nox -s black_fix\n\n\nSetup / Run Saltimbanque for dev\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nInstall dependencies::\n\n    python3 -m venv __env__\n    __env__/bin/pip install -e \".[dev]\"\n\nRun::\n\n    __env__/bin/flask run\n\n\nChangelog\n---------\n\n* **[NEXT]** (changes on ``master``, but not released yet):\n\n  * Nothing yet ;)\n\n* **v1.2.1:**\n\n  * misc: Added missing AGPL license\n\n* **v1.2.0:**\n\n  * Fixes deployment\n  * Updates dependencies\n  * Adds PNG raster function in addition to PDF\n\n* **v1.1.1:** Fix encoding issue when decoding URLs\n* **v1.1.0:** Encode URL in base64 to avoid issue when used with an Nginx front\n* **v1.0.1:** Update deploy config\n* **v1.0.0:** Initial release\n\n\n.. |Github| image:: https://img.shields.io/github/stars/wanadev/saltimbanque?label=Github&logo=github\n   :target: https://github.com/wanadev/saltimbanque\n.. |Discord| image:: https://img.shields.io/badge/chat-Discord-8c9eff?logo=discord&logoColor=ffffff\n   :target: https://discord.gg/BmUkEdMuFp\n.. |PYPI Version| image:: https://img.shields.io/pypi/v/saltimbanque.svg\n   :target: https://pypi.python.org/pypi/saltimbanque\n.. |Build Status| image:: https://github.com/wanadev/saltimbanque/actions/workflows/python-ci.yml/badge.svg\n   :target: https://github.com/wanadev/saltimbanque/actions\n.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://black.readthedocs.io/en/stable/\n.. |License| image:: https://img.shields.io/pypi/l/saltimbanque.svg\n   :target: https://github.com/wanadev/saltimbanque/blob/master/COPYING\n",
    "bugtrack_url": null,
    "license": "AGPLv3",
    "summary": "Provides an API to convert web pages to PDF",
    "version": "1.2.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "339b5595ea4fd368d893cf4dc597cb10f05a5483df331db79fde6add1a5fec0a",
                "md5": "250063edeca7f8a49ed46b478fb09575",
                "sha256": "47e30b103f9c4ddb43e9137c9d57f39f287028636a5d58b276d85c339554bb45"
            },
            "downloads": -1,
            "filename": "saltimbanque-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "250063edeca7f8a49ed46b478fb09575",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 17013,
            "upload_time": "2024-09-02T07:38:02",
            "upload_time_iso_8601": "2024-09-02T07:38:02.153545Z",
            "url": "https://files.pythonhosted.org/packages/33/9b/5595ea4fd368d893cf4dc597cb10f05a5483df331db79fde6add1a5fec0a/saltimbanque-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a689577515cbebcb6fc76bd2e9e8f2cca4306ca347b8fee85d35067d9c3eb333",
                "md5": "facc53aac0154b5df90425a9ddbe2c52",
                "sha256": "6940594e226631b1d2886f47237f8e4f9d56b53d4626a0499b62d212ce78732e"
            },
            "downloads": -1,
            "filename": "saltimbanque-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "facc53aac0154b5df90425a9ddbe2c52",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16009,
            "upload_time": "2024-09-02T07:38:03",
            "upload_time_iso_8601": "2024-09-02T07:38:03.687699Z",
            "url": "https://files.pythonhosted.org/packages/a6/89/577515cbebcb6fc76bd2e9e8f2cca4306ca347b8fee85d35067d9c3eb333/saltimbanque-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-02 07:38:03",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "saltimbanque"
}
        
Elapsed time: 0.37479s