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.
Metadata
Release files for perfometrics 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| perfometrics-0.0.6.tar.gz | 17.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| perfometrics-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / perfometrics-0.0.6.tar.gz
| Download URL | perfometrics-0.0.6.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c5cf2f9add5d51c0c342c616155d50951adfc8b38c55ff7e1ac071fa344abf67
|
|
BLAKE2b-256 checksum How to use checksums |
138642055267de1b8d24ae5eb250a60d742ac0eb4a1e6e91359636c8a4d191fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / perfometrics-0.0.6-py3-none-any.whl
| Download URL | perfometrics-0.0.6-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49de1a1ee90a044faff7fe84f82ce0d2cbde32a03aa70acdf4fdb178965856fe
|
|
BLAKE2b-256 checksum How to use checksums |
5a6a6794514043faa2f78df1d163c35e1c66dc6722b80ecad4631b5d779acd7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for perfometrics 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.