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.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

prerender-0.7.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file prerender-0.7.1.tar.gz.

File metadata

  • Download URL: prerender-0.7.1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for prerender-0.7.1.tar.gz
Algorithm Hash digest
SHA256 167d88439fab40f403cf0d638c9cc4a8c9853847a8a2597becc5eab00057b137
MD5 954e4a9416f75c49fede490351d0e9b8
BLAKE2b-256 cc7b8d5a45e8243de23c68706d4cdc1f27aca51749deec7022cfcfde449c6caa

See more details on using hashes here.

File details

Details for the file prerender-0.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prerender-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 228e09fb86b2016f5422ebaad114e9807a286c1584f15a59fc444c582ad015e7
MD5 711fa52f55f2e286c492d4d20e1ccae4
BLAKE2b-256 b0426b9c96781bdbe4119994fdf14b494c132b7e55cefa048ff56861b301931c

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