Coder Social home page Coder Social logo

lex-2008 / python-gtmetrix2 Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 169 KB

A Python client library for GTmetrix REST API v2.0

License: MIT License

Python 100.00%
python python3 python-library gtmetrix gtmetrix-api performance performance-testing lighthouse pagespeed yslow

python-gtmetrix2's Introduction

python-gtmetrix2

python-gtmetrix2 is a Python client library for GTmetrix REST API v2.0 (hence 2 in the name).

Build Status codecov Code style: black Documentation Status License: MIT

PyPI - Latest Version PyPI - Python Version PyPI - Downloads Monthly PyPI - Downloads Daily

Inspired by the library with a similar name.

Installation:

via pip

pip install python-gtmetrix2

manual

  • Clone or download and extract the repository
  • Copy the src/python-gtmetrix2 directory to your project directory

Usage:

Simplest example:

import json
import python_gtmetrix2

api_key = "e8ddc55d93eb0e8281b255ea236dcc4f"    # your API key
url = "http://example.com"                      # URL to test

account = python_gtmetrix2.Account(api_key)     # init
test = account.start_test(url)                  # start test
test.fetch(wait_for_completion=True)            # wait for it to finish
report = test.getreport()                       # get test result

print(json.dumps(report, indent=2))             # do something useful with it

For a wordy introduction into this library, or a more technical explanation, dive into the docs

Versioning:

This project follows semver versioning scheme. Note that according to the semver, as long as the version number starts with 0, no guarantees regarding compatibility are given. Hence, when anyone starts using this library, please let the author know about it, so we can bump version number to one and "freeze" API compatibility.

python-gtmetrix2's People

Contributors

lex-2008 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

python-gtmetrix2's Issues

Issue in fetch function

Whenever i am calling fetch function its giving error:-

import json
import python_gtmetrix2

api_key = "e8ddc55d93eb0e8281b255ea236dcc4f" # your API key
account = python_gtmetrix2.Account(api_key) # init
test = account.start_test(url) # start test
test.fetch(wait_for_completion=True) # wait for it to finish
report = test.getreport() # get test result
print(json.dumps(report, indent=2)) # do something useful with it

Error:

TypeError: fetch() got an unexpected keyword argument 'wait_for_completion'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.