marcstreeter / phantomas-python

Python module for easy integration with phantomas

Home Page:https://pypi.python.org/pypi/phantomas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python module for easy integration with phantomas - PhantomJS-based modular web performance metrics collector

Latest Version

Latest Version

Supported Python versions

image

Install

In order to use this module you need phantomas "binary" installed in your system.

sudo make install

This will run npm install -g phantomas.

Module's API

import json
from phantomas import Phantomas

results = Phantomas(
    url="http://example.com",
    modules=['headers', 'requestsStats']
).run()

print('Generator: ' + results.get_generator())   # phantomas v1.9.0
print('\nMetrics: ' + json.dumps(results.get_metrics(), indent=True, sort_keys=True))
print('\nDomains: ' + json.dumps(results.get_offenders('domains'), indent=True))

# assertions
assert results.get_metric('notFound') == 0
assert results.get_metric('requests') < 5

More docs coming soon! Meanwhile please refer to example/example.py script.

About

Python module for easy integration with phantomas

https://pypi.python.org/pypi/phantomas

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 96.5%Language:Makefile 3.5%