Django Page Exporter documentation¶
Welcome to Django Page Exporter Documentation.
Developer Documentation¶
Configuration¶
How to use¶
The followings SETTINGS should contain values as follow:
INSTALLED_APPS = (
...
'page_exporter',
...
)
url.py should contain:
urlpatterns = patterns(
...
(r'^capture/', include('page_exporter.urls')),
...
)
you can ovverride default configuration using:
PAGE_EXPORTER_CAPTURE_SCRIPT = './capture.js'
PAGE_EXPORTER_CLI_ARGS = []
PAGE_EXPORTER_PHANTOMJS_CMD = None
PAGE_EXPORTER_WAIT = '2000'
Parameters¶
You can then obtain a screenshot using the following GET or POST parameters :
url
The website URL to capture. This can be a fully qualified URL, or the name of a URL to be reversed in your Django project. Note: do not forget to encode the url.
selector
CSS3 selector. It will restrict the screenshot to the selected element.
method
HTTP method to be used (default: GET)
width
Viewport width (default: 1400)
height
Viewport height (default: 900)
data
HTTP data to be posted (default: {})
wait
milliseconds used as timeout before capture
page_status
string. The screenshot will be performed only once document.page_status is equal to the passed value. Typical usage: if your page contains a heavy javascript processing, you can add the page_status variable at the end of the processing to make sure the screenshot will get the page properly rendered.
render
png (default), pdf (will use media print css), jpg (PIL needed)
cookie_name, cookie_value, cookie_domain
cookie information to send for authenticated pages
page_exporter package¶
Submodules¶
page_exporter.urls module¶
page_exporter.utils module¶
-
page_exporter.utils.
image_postprocess
(imagefile, output, size, crop, render)[source]¶ Resize and crop captured image, and saves to output. (can be stream or filename)
Module contents¶
-
page_exporter.
get_git_changeset
()[source]¶ Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format. This value isn’t guaranteed to be unique, but collisions are very unlikely, so it’s sufficient for generating the development version numbers.