Skip to main content

Python Markdown extension to include local or remote files

Project description

Build Status

PhantomJS wrapper in Python

Pre requisites

  1. phantomjs: phantomjs command line tool.
  2. Python 3


pip install phantomjs


Using with a custom phantomjs script:

from phantomjs import Phantom

phantom = Phantom()

conf = {
    'url': '',   # Mandatory field
output = phantom.download_page(conf, js_path='/my/phantomjs/script/path')

In your phantomjs script, you can take the url as:

var system = require('system');
var json = JSON.parse(system.args[1]);
var url = json.url;

Using the default phantomjs script provided with this package:

from phantomjs import Phantom

phantom = Phantom()

conf = {
    'url': '',   # Mandatory field
    'output_type': 'html',          # json for json
    'min_wait': 1000,               # 1 second
    'max_wait': 30000,              # 30 seconds
    'selector': '',                 # CSS selector if there's any
    'resource_timeout': 3000,       # 3 seconds
    'headers': {
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.72 Safari/537.36",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
        "Sec-Fetch-Mode": "navigate",
        'Sec-Fetch-Site': 'same-origin',
        'Upgrade-Insecure-Requests': '1',
    'cookies': [
        {'name': '_Country', 'value': 'US', 'domain': '',},
        {'name': '_Currency', 'value': 'USD', 'domain': '',},
    'functions': [

output = phantom.download_page(conf)

Project details

Download files

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

Files for phantomjs, version 1.1.4
Filename, size File type Python version Upload date Hashes
Filename, size phantomjs-1.1.4-py3-none-any.whl (8.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size phantomjs-1.1.4.tar.gz (5.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page