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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file prerender-0.7.3.dev3.tar.gz
.
File metadata
- Download URL: prerender-0.7.3.dev3.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c292ff83bc5f18de83385747a9b4aefa90571e924236675c93164444b810ad |
|
MD5 | c9bf682a7cb61ca69d9b419b9b16c7e0 |
|
BLAKE2b-256 | 532fceafdaf3695c3efe97eaf5526f2540506ba1e0554aa3355fafa0029b5e9c |
File details
Details for the file prerender-0.7.3.dev3-py3-none-any.whl
.
File metadata
- Download URL: prerender-0.7.3.dev3-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 782d767964e20f4ae30856229de9c3f27bfa89c597390216bf6aefa29285b655 |
|
MD5 | 7e89f1b5e7a4d4bcf5aa98a6535bcec9 |
|
BLAKE2b-256 | a0c155973b3a2957957384577c305d24b171fe95e2dc7462644bcd0e69482498 |