{ "info": { "author": "Mathieu Leplatre", "author_email": "mathieu.leplatre@makina-corpus.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7" ], "description": "===================\n django-screamshot\n===================\n\n.. image:: https://secure.travis-ci.org/makinacorpus/django-screamshot.svg?branch=master\n :alt: Build Status\n :target: http://travis-ci.org/makinacorpus/django-screamshot\n\n.. image:: https://img.shields.io/pypi/v/django-screamshot.svg\n :alt: Latest PyPI version\n :target: https://pypi.python.org/pypi/django-screamshot/\n\n.. image:: https://img.shields.io/pypi/dw/django-screamshot.svg\n :alt: Number of PyPI downloads\n :target: https://pypi.python.org/pypi/django-screamshot/\n\n.. image:: https://img.shields.io/github/downloads/makinacorpus/django-screamshot/total.svg\n :alt: Number of Git Hub downloads\n :target: https://github.com/makinacorpus/django-screamshot/archive/master.zip\n\n.. image:: https://img.shields.io/pypi/format/django-screamshot.svg\n :alt: Format\n :target: https://pypi.python.org/pypi/django-screamshot/\n\n.. image:: https://img.shields.io/pypi/l/django-screamshot.svg\n :alt: License\n :target: https://raw.githubusercontent.com/makinacorpus/django-screamshot/master/LICENSE\n\n\n*django-screamshot* is a **very naive** implementation of Web pages capture\nwith `CasperJS `_ (*aaAAaah!*, `phantomjs `_:))\n\n(*See the issues pages for more details about what remains to be done.*)\n\nCheckout `screamshotter `_,\nthe simplest Django project powered by *django-screamshot*.\n\n\n=======\nINSTALL\n=======\n\nFirst make sure you have either the ``casperjs`` or ``phantomjs`` command in your ``PATH``, using\nrelated installation instructions:\n * `CasperJS `_.\n * `PhantomJS `_.\n\nThen install the egg :\n\n::\n\n pip install django-screamshot\n\n\n=====\nUSAGE\n=====\n\n* Add ``screamshot`` to your ``INSTALLED_APPS``\n\n\nAs a screenshot Web API\n-----------------------\n\nAdd it to your project URLs :\n\n::\n\n urlpatterns = patterns('',\n ...\n url(r'^capture/$', include('screamshot.urls', namespace='screamshot', app_name='screamshot')),\n )\n\nYou can then obtain a screenshot using the following GET parameters :\n\nurl\n The website URL to capture. This can be a fully qualified URL, or the\n name of a URL to be reversed in your Django project. Note: do not forget to\n encode the url.\n\nselector\n CSS3 selector. It will restrict the screenshot to the selected element.\n\nmethod\n HTTP method to be used (*default:* ``GET``)\n\nwidth\n Viewport width (*default:* ``1400``)\n\nheight\n Viewport height (*default:* ``900``)\n\ndata\n HTTP data to be posted (*default:* ``{}``)\n\nwaitfor\n CSS3 selector. The screenshot will be performed only once this selector is\n satisfied. Typical usage: if your page contains a heavy javascript processing,\n you can add a CSS class on an element when the processing is finished to make\n sure the screenshot will get the page properly rendered.\n\nrender\n If render=html, it will return an HTML page containing the image and where the\n print diaplo box will be automatically opened.\n\nsize\n Resize image (width x height, e.g: ``500x500``), need install ``PIL`` or ``Pillow``.\n\ncrop\n If ``true``, then resulting image is cropped to match specified size.\n\nFor example : http://server/capture/?url=http://django-fr.org&selector=body&width=1024&height=768&size=500x500\n\n\n\nAs a template tag\n-----------------\n\nYou can include screenshots in your pages using a template tag. It will\nperform the capture and return the base64 version of the resulting image.\n\nThis is very useful if you don't want to expose the capture API publicly.\n\n::\n\n {% base64capture URL SELECTOR %}\n\n\nFor example, in a SVG template :\n\n::\n\n {% load screamshot %}\n ...\n \n \n\n\nIf you run the capture server on a different instance, you can specify the \nroot url for reversing (*default is local*) :\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CAPTURE_ROOT_URL': 'http://127.0.0.1:8001',\n }\n\n\nAs a library - render local Django template\n-------------------------------------------\nSometimes, you don't have access to the request object. A typical example would be creating a PDF receipt for a customer and emailing it. Both of these tasks can take a while, so it is natural to push them into some queue (like RabbitMQ). But if your pdf-rendering task get's executed, you don't have access to the request object. Don't worry - you can still use screamshot as a library. Here's how.\n\n::\n\n from screamshot.utils import render_template\n\n # you can either render the template to a TemporaryFile:\n\n with render_template('my-template.html', {'context': 'variables'}) as output:\n # do anything you want with the output\n # like attach it to email message, etc.\n print(output.name)\n\n # or you can specify a path instead:\n render_template('my-template.html',\n {'context': 'variables'},\n output='/home/you/rendering.png',\n format='png')\n\n\nPlease note, that in order to load your static files, screamshot will try to replace all STATIC_URL occurence with a local path to your static files (only if they are not hosted via https of course)\n\nCustomizing the page rendering\n------------------------------\n\nThe CasperJS script appends the `screamshot` CSS class on the `body` element.\nYou can easily customize the rendering for printing using this CSS marker in\nyour CSS stylesheet:\n\n::\n\n .screamshot #navigation {\n display: none;\n }\n .screamshot #main {\n margin: 2em;\n }\n\nCapture views with authentication\n---------------------------------\n\nYou can use Basic HTTP authentication in your Django project, create a dedicated\nuser for screenshots and capture the full URL with credentials (``http://user:password@host/page/``).\n\nAlternatively, you can use a specific view decorator.\n\nDefine the authorized IP to capture your pages in your settings :\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CAPTURE_ALLOWED_IPS': ('127.0.0.1',),\n }\n\nAnd use the provided decorator : \n\n::\n\n from screamshot.decorators import login_required_capturable\n\n\n @login_required_capturable\n def your_view(request):\n ...\n\n\nRenderer command and CLI arguments\n----------------------------------\nYou can specify which renderer you would like to use, by setting the \n``CAPTURE_METHOD`` setting. The default value is 'casperjs'. Possible values\nare 'casperjs' and 'phantomjs'.\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CAPTURE_METHOD': 'phantomjs',\n }\n\n\nBy default, we look for thr CasperJS/PhantomJS binary in the ``PATH``\nenvironment variable (like ``which``), but you can bypass this:\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CASPERJS_CMD': '/home/you/Downloads/apps/casperjs',\n 'PHANTOMJS_CMD': '/home/you/Downloads/apps/phantomjs'\n }\n\n\nPlease note, that the ``CAPTURE_METHOD`` setting specifies which location would\nbe evaluated, i.e. if you set ``CAPTURE_METHOD`` to 'phantomjs', ``PHANTOMJS_CMD``\nwould be evaluated.\n\nYou can also specify PhantomJS/CasperJS extra-args, such as\n ``--disk-cache=true`` with the ``CLI_ARGS`` setting :\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CLI_ARGS': ['--disk-cache=true', '--max-disk-cache-size=30000']\n }\n\nSee related documentation on PhantomJS and CasperJS homepages.\n\n\nYou can also override the capture script. A default implementation uses capture\nscript written for CasperJS. A default capture script for PhantomJS is also provided.\n\nIf you have your own script which you would like to use, specify it in \n``CAPTURE_SCRIPT`` option.\n\n::\n\n SCREAMSHOT_CONFIG = {\n 'CAPTURE_SCRIPT': '/home/you/scripts/capture.js',\n }\n\n\nNotes about runserver\n---------------------\n\nIf you want to test it using ``manage.py runserver``, you won't be able\nto capture pages coming from the same instance.\n\nRun it twice (on two ports) and configure ``CAPTURE_ROOT_URL``.\n\n\n=======\nAUTHORS\n=======\n\n * Mathieu Leplatre \n * mozillag\n * dynamicguy\n * Eric Brehault \n\n|makinacom|_\n\n.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif\n.. _makinacom: http://www.makina-corpus.com\n\n=======\nLICENSE\n=======\n\n * Lesser GNU Public License\n\n\n=========\nCHANGELOG\n=========\n\n0.8.2 (2018-07-04)\n==================\n\n* Response errors status code from 400 to 500\n\n\n0.8.1 (2017-06-14)\n==================\n\n* Fix phantom path in PATH\n\n\n0.8.1 (2017-05-05)\n==================\n\n* Fix python 3 support\n* Add support for Django 1.11\n* Drop support for Django <1.8\n\n\n0.7.0 (2017-01-08)\n==================\n\n* Support for rendering PDF\n* Python 3 support\n* Django 1.8 support\n* Add TEST_CAPTURE_SCRIPT setting\n\n\n0.6.0 (2014-11-27)\n==================\n\n* Added support of pure PhantomJS capture, i.e. without CasperJS, without selector (by Mateusz Mikolajczyk)\n* Support for capturing locally rendered templates, without external request (by Mateusz Mikolajczyk)\n\n\n0.5.0 (2014-11-11)\n==================\n\n* Added screenshot model and adminsite support (by Luc Milland)\n* Allows to wait for a given time (milliseconds) before doing the screenshot (by Florent Lebreton)\n* Replace mimetype by content_type in HttpResponse for django1.7 compliance (by Florent Lebreton)\n\n\n0.4.0 (2014-03-19)\n==================\n\n* If URL not provided, use request's host (by Mozillag)\n* Allow to provide a custom PhantomJS command (by mo-mughrabi)\n* Improved logging\n* Added some minimalistic unit tests\n\n\n0.3.1 (2014-01-31)\n==================\n\n* Fix requirement spelling\n\n\n0.3.0 (2013-09-05)\n==================\n\n* Return appropriate HTTP responses on parameter errors (400)\n* Better processing of capture errors, not for remote JS yet. (ref #1)\n* Save temporary file step is specified output for ``casperjs_capture`` is a filepath\n* Add a *screamshotter* orphan branch, as a demo Django project\n* Ability to control image format (other than ``png`` or ``html``)\n\n\n0.2.0 (2013-08-18)\n==================\n\n* CASPERJS_CMD setting to bypass PATH lookup\n* Query ``crop`` parameter to control resize\n* Query ``size`` parameter to control image size\n* Query ``render`` parameter to control output format\n* Remove ``remote.message`` loging\n* Query ``waitFor`` parameter to control capture timing\n* Inject *screamshot* class on *body* to allow capture styling\n* Use capture instead of captureSelector if no selector provided\n* Query parameters to control viewport size\n* Ability to add extra command-line arguments\n* Updated CasperJS CLI status code\n* Detect forwarded IP address in login decorator\n\n\n0.1.1 (2012-04-17)\n==================\n\n* Include package data\n\n\n0.1.0 (2012-04-17)\n==================\n\n* Initial working version\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/makinacorpus/django-screamshot", "keywords": "", "license": "LPGL, see LICENSE file.", "maintainer": "", "maintainer_email": "", "name": "django-screamshot", "package_url": "https://pypi.org/project/django-screamshot/", "platform": "", "project_url": "https://pypi.org/project/django-screamshot/", "project_urls": { "Homepage": "https://github.com/makinacorpus/django-screamshot" }, "release_url": "https://pypi.org/project/django-screamshot/0.8.2/", "requires_dist": null, "requires_python": "", "summary": "Web pages capture using Django & CasperJS", "version": "0.8.2" }, "last_serial": 5491222, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "b5a94ddec0feb9136936e677f94636c9", "sha256": "16ac2892390ae7e2a5db5ac9f64c1057b9594b1bfb57b63a5589b0808fa91081" }, "downloads": -1, "filename": "django-screamshot-0.1.tar.gz", "has_sig": false, "md5_digest": "b5a94ddec0feb9136936e677f94636c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8810, "upload_time": "2012-04-17T11:26:47", "url": "https://files.pythonhosted.org/packages/64/60/70f443e50ac890f7a26c6021200fbc6c3d7deb6b24b5622a036dd80a319d/django-screamshot-0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "3d0910a6ba4be563e85b70636c7d2fca", "sha256": "25c856beee9696c00eb78e24772d66c5ff771c090385c94b602902040d497109" }, "downloads": -1, "filename": "django-screamshot-0.2.0.zip", "has_sig": false, "md5_digest": "3d0910a6ba4be563e85b70636c7d2fca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20505, "upload_time": "2013-08-18T07:01:05", "url": "https://files.pythonhosted.org/packages/e1/a3/dd22e40db2b2441cd2a26a676080a803c0e420c2f3dd47f6b009164fb248/django-screamshot-0.2.0.zip" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "58ad13504659a249bdf56d291816dd0d", "sha256": "67ba4acb030c89fad95fa1648a132ce2af36b71b681e3becfc93445124be1a0b" }, "downloads": -1, "filename": "django-screamshot-0.3.0.zip", "has_sig": false, "md5_digest": "58ad13504659a249bdf56d291816dd0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22083, "upload_time": "2013-09-05T08:54:21", "url": "https://files.pythonhosted.org/packages/d2/4d/8c5eed7f35e0de2e9b3d688dc7841fdcf1ed5543e8feae3c9e5e14675925/django-screamshot-0.3.0.zip" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "1fbff0148902feb086f257fed8700539", "sha256": "fa46195bda89ad88e187bfd3b3e1ef443175293345a193ca4e617e47dfd15d92" }, "downloads": -1, "filename": "django-screamshot-0.3.1.zip", "has_sig": false, "md5_digest": "1fbff0148902feb086f257fed8700539", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22162, "upload_time": "2014-01-31T15:30:16", "url": "https://files.pythonhosted.org/packages/c1/07/a8cbc7f329693ff5b8ffb18a4565285ee4af3bc4e105a5d4fd5f02eebdb4/django-screamshot-0.3.1.zip" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "d260ac6926cc5827e23ae088c709bca9", "sha256": "40a437b37aee69f69350fd658af2d667459f69c5db9d26611bbe99694f81058f" }, "downloads": -1, "filename": "django-screamshot-0.4.0.zip", "has_sig": false, "md5_digest": "d260ac6926cc5827e23ae088c709bca9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23110, "upload_time": "2014-03-19T08:53:08", "url": "https://files.pythonhosted.org/packages/43/44/d9350ec1db1010ac0a84002a0440382d43013034ca9d49dacd7766224311/django-screamshot-0.4.0.zip" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "53b085da79858810d8a143bbe6e505cd", "sha256": "c7f44fff78b5b2495a21a28b2b1448d546738b02e7b75cba4a52b2aecd2a0e05" }, "downloads": -1, "filename": "django-screamshot-0.5.0.zip", "has_sig": false, "md5_digest": "53b085da79858810d8a143bbe6e505cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26301, "upload_time": "2014-11-11T13:05:55", "url": "https://files.pythonhosted.org/packages/42/d8/20d487e6d983ab603bf1361d33a0d51b9a06cbb5dfd9a92b64e1521d25c9/django-screamshot-0.5.0.zip" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "1f15600d9df7cbd6cfbfb43612dc10db", "sha256": "0a80589ce4fa6c1a32b9882a682fe1254b6733468bcad778b2913f1df749feab" }, "downloads": -1, "filename": "django-screamshot-0.6.0.zip", "has_sig": false, "md5_digest": "1f15600d9df7cbd6cfbfb43612dc10db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30527, "upload_time": "2014-11-27T10:27:28", "url": "https://files.pythonhosted.org/packages/88/dc/65bdeaad57e80128714759f7f668f129611bfacdebdf07d6c2a16ef00bde/django-screamshot-0.6.0.zip" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "7a49c9a3a7722cda78f9a9a5baed4527", "sha256": "f3c495a4c23d6c628b150c7bb6d862d1830ee6fd97e58459a53ca3acf5554d35" }, "downloads": -1, "filename": "django-screamshot-0.7.0.tar.gz", "has_sig": false, "md5_digest": "7a49c9a3a7722cda78f9a9a5baed4527", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21311, "upload_time": "2017-01-08T18:40:14", "url": "https://files.pythonhosted.org/packages/3b/2f/c73df8e513c2c3e17556842132c9c6e66c37b24fdfbbb1bd2c282cbc9a6a/django-screamshot-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "a9d878dd68f941ccb86d3edebdb7bcfe", "sha256": "fc4567132edad145b6d094210d0c786f31e0a568795584eb09fb9bd2a4e51614" }, "downloads": -1, "filename": "django-screamshot-0.8.0.tar.gz", "has_sig": false, "md5_digest": "a9d878dd68f941ccb86d3edebdb7bcfe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20423, "upload_time": "2017-05-05T09:25:11", "url": "https://files.pythonhosted.org/packages/6b/de/a8687f810583647dd1333395bd5b9f076778a755f57ab6f62460dcff3f0a/django-screamshot-0.8.0.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "e36a9199624cf2fa25f1cd600b0985fa", "sha256": "b855a5dced4eb611eaaedf4d1a32a9acca72cc1a773a7c3ada3e4a7c76ceb6fd" }, "downloads": -1, "filename": "django-screamshot-0.8.1.tar.gz", "has_sig": false, "md5_digest": "e36a9199624cf2fa25f1cd600b0985fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19242, "upload_time": "2017-06-14T08:12:47", "url": "https://files.pythonhosted.org/packages/9d/cc/94ccfc12ec5b2f6f36ce8e1633b4393bb7c1ceb31937beefd8a324c6ef14/django-screamshot-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "c15d9089bb31919618babc469445e7c2", "sha256": "afbb25a6b0d839f14a2bff95f2912216234f7cc1a1321fe4ad3faa58478e0a67" }, "downloads": -1, "filename": "django-screamshot-0.8.2.tar.gz", "has_sig": false, "md5_digest": "c15d9089bb31919618babc469445e7c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22421, "upload_time": "2018-07-04T12:55:51", "url": "https://files.pythonhosted.org/packages/a7/49/ca672699fe6ead87567a46f3bcc71e11045fd8a3a602d44fd9a663646a0f/django-screamshot-0.8.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c15d9089bb31919618babc469445e7c2", "sha256": "afbb25a6b0d839f14a2bff95f2912216234f7cc1a1321fe4ad3faa58478e0a67" }, "downloads": -1, "filename": "django-screamshot-0.8.2.tar.gz", "has_sig": false, "md5_digest": "c15d9089bb31919618babc469445e7c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22421, "upload_time": "2018-07-04T12:55:51", "url": "https://files.pythonhosted.org/packages/a7/49/ca672699fe6ead87567a46f3bcc71e11045fd8a3a602d44fd9a663646a0f/django-screamshot-0.8.2.tar.gz" } ] }