Skip to main content

A python library to measure the performance metrics of a website

Project description

Perfometrics

Perfometrics is a Python library for measuring the performance of a given URL using the pycurl library. The library provides various metrics such as HTTP status code, time taken for DNS resolution, time taken for establishing TCP connection, time taken for establishing SSL/TLS connection, time taken for the first byte of the response, time taken for data transfer, and total time taken for the request.

Installation

To install perfometrics, simply run the following command:

pip install perfometrics

Usage

To use perfometrics, you can import the curl module and create a CurlUptime object with the URL you want to measure. Here's an example:

import perfometrics.curl as pcurl

url = 'https://example.com'
curl_uptime = pcurl.CurlUptime(url)
metrics = curl_uptime.get_metrics()

print('Metrics for', url)
print('HTTP status code:', metrics['status_code'])
print('Time taken for DNS resolution:', metrics['dns_lookup'], 'seconds')
print('Time taken for establishing TCP connection:', metrics['tcp'], 'seconds')
print('Time taken for establishing SSL/TLS connection:', metrics['ssl_tls'], 'seconds')
print('Time taken for the first byte of the response:', metrics['ttfb'], 'seconds')
print('Time taken for data transfer:', metrics['data_transfer'], 'seconds')
print('Total time taken for the request:', metrics['total'], 'seconds')

This will output something like:

Metrics for https://example.com
HTTP status code: 200
Time taken for DNS resolution: 0.003439 seconds
Time taken for establishing TCP connection: 0.057725 seconds
Time taken for establishing SSL/TLS connection: 0.09169 seconds
Time taken for the first byte of the response: 0.213251 seconds
Time taken for data transfer: 0.067498 seconds
Total time taken for the request: 0.282891 seconds

After you're done with the CurlUptime object, you should call its close_session() method to close the pycurl.Curl() session.

License

perfometrics is licensed under the GNU General Public License v3.0. See the LICENSE file for more information.

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

perfometrics-0.0.6.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perfometrics-0.0.6-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file perfometrics-0.0.6.tar.gz.

File metadata

  • Download URL: perfometrics-0.0.6.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for perfometrics-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c5cf2f9add5d51c0c342c616155d50951adfc8b38c55ff7e1ac071fa344abf67
MD5 c230b042dba3fafa10a9f8201e4b1896
BLAKE2b-256 138642055267de1b8d24ae5eb250a60d742ac0eb4a1e6e91359636c8a4d191fc

See more details on using hashes here.

File details

Details for the file perfometrics-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: perfometrics-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for perfometrics-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 49de1a1ee90a044faff7fe84f82ce0d2cbde32a03aa70acdf4fdb178965856fe
MD5 2885498b9746d3d771b2753387836f99
BLAKE2b-256 5a6a6794514043faa2f78df1d163c35e1c66dc6722b80ecad4631b5d779acd7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page