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

Install

pip install phantomjs

Usage

from phantomjs import Phantom

phantom = Phantom()

conf = {
    'url': 'http://example.com/',   # 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': '.google.com',},
        {'name': '_Currency', 'value': 'USD', 'domain': '.google.com',},
    ],
}


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.

Source Distribution

phantomjs-1.0.1.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

phantomjs-1.0.1-py3-none-any.whl (5.6 kB view hashes)

Uploaded Python 3

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