Skip to main content

Render JavaScript-rendered page as HTML using headless Chrome

Project description

# prerender

Render JavaScript-rendered page as HTML/PDF/mhtml/png/jpeg using headless Chrome

## Install Chrome

Headless mode is supported in Chrome unstable/dev channel, you should be able to install it via:

https://www.google.com/chrome/browser/beta.html?platform=linux

## Start Chrome Headless

`bash $ google-chrome-unstable --headless --remote-debugging-port=9222 --disable-gpu "about:blank" `

## Install Prerender

`bash $ pip install -U prerender `

## Start Prerender

As standalone application:

`bash $ prerender `

To run it under gunicorn:

`bash $ gunicorn --bind 0.0.0.0:3000 --worker-class sanic.worker.GunicornWorker prerender.app:app `

## How does it work

Say you deployed Prerender under http://prerender.example.com:8000, to render http://example.com you can do:

`bash $ # render HTML $ curl http://prerender.example.com:8000/http://example.com $ curl http://prerender.example.com:8000/html/http://example.com $ # render mhtml $ curl http://prerender.example.com:8000/mhtml/http://example.com $ # render PDF $ curl http://prerender.example.com:8000/pdf/http://example.com $ # render png $ curl http://prerender.example.com:8000/png/http://example.com $ # render jpeg $ curl http://prerender.example.com:8000/jpeg/http://example.com `

## Configure client

Please view the original NodeJs version [prerender](https://github.com/prerender/prerender#official-middleware) README.

## License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prerender-0.7.5.dev0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

prerender-0.7.5.dev0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file prerender-0.7.5.dev0.tar.gz.

File metadata

File hashes

Hashes for prerender-0.7.5.dev0.tar.gz
Algorithm Hash digest
SHA256 f88e71b1cedaa7edffcd3c34651604ff30770373e99f9e55c04cdc0bf678336e
MD5 d43cb464c9943a0aaaa4c4f9486f11f7
BLAKE2b-256 4e7db6632c21673ed1ceb00a91aa504ad3e3dd92e1cef33060e09ec0c6266e04

See more details on using hashes here.

File details

Details for the file prerender-0.7.5.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for prerender-0.7.5.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7c978f685492a624cc68285fe8828173a454b2491d5ea2aa9a72c58abdc54d4
MD5 5f3da19f9c8c4e099edef404fa6f2603
BLAKE2b-256 b97e6f8d871b0be7f56e3ed25f2131e1b62bbdf0232306aeec0fa0f658a90c1e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page