https://github.com/florimondmanca/httpxprof
A tool for profiling HTTPX using cProfile and SnakeViz
https://github.com/florimondmanca/httpxprof
httpx profiling python tool
Last synced: 5 months ago
JSON representation
A tool for profiling HTTPX using cProfile and SnakeViz
- Host: GitHub
- URL: https://github.com/florimondmanca/httpxprof
- Owner: florimondmanca
- License: mit
- Created: 2019-09-20T20:20:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-04T06:40:49.000Z (almost 5 years ago)
- Last Synced: 2025-01-03T05:47:04.835Z (5 months ago)
- Topics: httpx, profiling, python, tool
- Language: Python
- Homepage:
- Size: 139 KB
- Stars: 13
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# httpxprof
A tool for profiling [HTTPX](https://github.com/encode/httpx) using cProfile and [SnakeViz](https://jiffyclub.github.io/snakeviz/). No maintenance intended.

## Installation
- Install the version of HTTPX you'd like to profile against.
- Install this tool using pip:```bash
pip install -e git+https://github.com/florimondmanca/httpxprof#egg=httpxprof
```## Usage
```bash
# Run one of the built-in profiling cases:
httpxprof run async_client# View results:
httpxprof view async_client
```You can also:
- Run your profiling cases by passing Python scripts — useful to profile other HTTP client libraries.
- Profile against an HTTPS server using the `--https` option.```python
# aiohttp_single.py
import aiohttp
import sslimport httpxprof
async def main(config: httpxprof.Config) -> None:
ssl_context = ssl.create_default_context(cafile=config.client_cert())
async with aiohttp.ClientSession() as session:
for _ in config.requests():
async with session.get(config.url, ssl=ssl_context):
pass
``````bash
httpxprof run --https aiohttp_session.py
httpxprof view aiohttp_session.py
```You can ask for `--help` on `httpxprof` and any of the subcommands.