https://github.com/macbre/phantomas-python
Python module for easy integration with phantomas
https://github.com/macbre/phantomas-python
Last synced: about 1 year ago
JSON representation
Python module for easy integration with phantomas
- Host: GitHub
- URL: https://github.com/macbre/phantomas-python
- Owner: macbre
- License: bsd-3-clause
- Created: 2014-08-18T17:06:12.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T01:32:12.000Z (over 8 years ago)
- Last Synced: 2025-04-20T09:38:35.900Z (about 1 year ago)
- Language: Python
- Homepage: https://pypi.python.org/pypi/phantomas
- Size: 34.2 KB
- Stars: 7
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Python module for easy integration with `phantomas `__ - PhantomJS-based modular web performance metrics collector
.. image:: https://pypip.in/version/phantomas/badge.svg?style=flat
:target: https://pypi.python.org/pypi/phantomas/
:alt: Latest Version
.. image:: https://pypip.in/download/phantomas/badge.svg?period=week&style=flat
:target: https://pypi.python.org/pypi/phantomas/
:alt: Latest Version
.. image:: https://pypip.in/py_versions/phantomas/badge.svg?style=flat
:target: https://pypi.python.org/pypi/phantomas/
:alt: Supported Python versions
.. image:: https://travis-ci.org/macbre/phantomas-python.svg?branch=master
:target: https://travis-ci.org/macbre/phantomas-python
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",
exec_path="/my/path/to/phantomas", # optional
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.