sharphttp


Namesharphttp JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA fast HTTP client implementation in Rust for Python
upload_time2024-11-24 00:13:15
maintainerNone
docs_urlNone
authoracatto <nothanks@example.com>
requires_python>=3.7
licenseMIT
keywords http client async rust
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🚀 SharpHTTP

A blazingly fast HTTP client implementation in Rust for Python, offering exceptional performance and reliability!

[![PyPI version](https://badge.fury.io/py/sharphttp.svg)](https://badge.fury.io/py/sharphttp)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## ✨ Features

- 🏃‍♂️ **Lightning Fast**: Up to 3.3x faster than aiohttp
- 🔒 **Secure**: Built on top of hyper-tls
- 🔄 **Async-First**: Native async/await support
- 🛠 **Resource Efficient**: Optimized connection pooling and memory usage
- 🌐 **HTTP/2 Support**: Modern protocol features out of the box

## 🚄 Performance

Real-world benchmarks show significant performance improvements over other popular HTTP clients:

| Client       | Mean (ms) | Min (ms) | Max (ms) |
|-------------|-----------|----------|-----------|
| SharpHTTP   | 13.50     | 9.41     | 26.18    |
| aiohttp     | 45.06     | 21.79    | 1062.42  |

**SharpHTTP is 233.7% faster on average!** 📈

## 🔧 Installation

```bash
pip install sharphttp
```

## 📚 Usage

```python
import asyncio
from sharphttp import ClientSession

async def main():
    async with ClientSession() as session:
        # Simple GET request
        response = await session.get('https://api.example.com/data')
        
        # Print response status
        print(response.status)  # 200
        
        # Get response text
        text = await response.text()
        print(text)

        # With headers and query parameters
        response = await session.get(
            'https://api.example.com/search',
            headers={'Authorization': 'Bearer token'},
            params={'q': 'search term'}
        )

asyncio.run(main())
```

## 🔍 API Reference

### ClientSession

The main interface for making HTTP requests.

#### Methods

- `__init__()`: Create a new client session
- `get(url, *, headers=None, params=None)`: Perform GET request
  - `url`: Target URL (string)
  - `headers`: Optional dictionary of headers
  - `params`: Optional dictionary of query parameters

### Response

Represents an HTTP response.

#### Properties

- `status`: HTTP status code (int)
- `headers`: Response headers (dict)

#### Methods

- `text()`: Get response body as text (async)

## 🏗 Building from Source

1. Install Rust and Python development dependencies
2. Clone the repository
```bash
git clone https://github.com/theoneandonlyacatto/sharphttp
cd sharphttp
```
3. Build the package
```bash
pip install maturin
maturin develop --release
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## 📝 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- Built with [PyO3](https://github.com/PyO3/pyo3)
- Powered by [Hyper](https://github.com/hyperium/hyper)

---

<p align="center">Made with ❤️ by <a href="https://github.com/theoneandonlyacatto">acatto</a></p>

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sharphttp",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "http, client, async, rust",
    "author": "acatto <nothanks@example.com>",
    "author_email": "acatto <nothanks@example.com>",
    "download_url": null,
    "platform": null,
    "description": "# \ud83d\ude80 SharpHTTP\r\n\r\nA blazingly fast HTTP client implementation in Rust for Python, offering exceptional performance and reliability!\r\n\r\n[![PyPI version](https://badge.fury.io/py/sharphttp.svg)](https://badge.fury.io/py/sharphttp)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## \u2728 Features\r\n\r\n- \ud83c\udfc3\u200d\u2642\ufe0f **Lightning Fast**: Up to 3.3x faster than aiohttp\r\n- \ud83d\udd12 **Secure**: Built on top of hyper-tls\r\n- \ud83d\udd04 **Async-First**: Native async/await support\r\n- \ud83d\udee0 **Resource Efficient**: Optimized connection pooling and memory usage\r\n- \ud83c\udf10 **HTTP/2 Support**: Modern protocol features out of the box\r\n\r\n## \ud83d\ude84 Performance\r\n\r\nReal-world benchmarks show significant performance improvements over other popular HTTP clients:\r\n\r\n| Client       | Mean (ms) | Min (ms) | Max (ms) |\r\n|-------------|-----------|----------|-----------|\r\n| SharpHTTP   | 13.50     | 9.41     | 26.18    |\r\n| aiohttp     | 45.06     | 21.79    | 1062.42  |\r\n\r\n**SharpHTTP is 233.7% faster on average!** \ud83d\udcc8\r\n\r\n## \ud83d\udd27 Installation\r\n\r\n```bash\r\npip install sharphttp\r\n```\r\n\r\n## \ud83d\udcda Usage\r\n\r\n```python\r\nimport asyncio\r\nfrom sharphttp import ClientSession\r\n\r\nasync def main():\r\n    async with ClientSession() as session:\r\n        # Simple GET request\r\n        response = await session.get('https://api.example.com/data')\r\n        \r\n        # Print response status\r\n        print(response.status)  # 200\r\n        \r\n        # Get response text\r\n        text = await response.text()\r\n        print(text)\r\n\r\n        # With headers and query parameters\r\n        response = await session.get(\r\n            'https://api.example.com/search',\r\n            headers={'Authorization': 'Bearer token'},\r\n            params={'q': 'search term'}\r\n        )\r\n\r\nasyncio.run(main())\r\n```\r\n\r\n## \ud83d\udd0d API Reference\r\n\r\n### ClientSession\r\n\r\nThe main interface for making HTTP requests.\r\n\r\n#### Methods\r\n\r\n- `__init__()`: Create a new client session\r\n- `get(url, *, headers=None, params=None)`: Perform GET request\r\n  - `url`: Target URL (string)\r\n  - `headers`: Optional dictionary of headers\r\n  - `params`: Optional dictionary of query parameters\r\n\r\n### Response\r\n\r\nRepresents an HTTP response.\r\n\r\n#### Properties\r\n\r\n- `status`: HTTP status code (int)\r\n- `headers`: Response headers (dict)\r\n\r\n#### Methods\r\n\r\n- `text()`: Get response body as text (async)\r\n\r\n## \ud83c\udfd7 Building from Source\r\n\r\n1. Install Rust and Python development dependencies\r\n2. Clone the repository\r\n```bash\r\ngit clone https://github.com/theoneandonlyacatto/sharphttp\r\ncd sharphttp\r\n```\r\n3. Build the package\r\n```bash\r\npip install maturin\r\nmaturin develop --release\r\n```\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please feel free to submit a Pull Request.\r\n\r\n## \ud83d\udcdd License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## \ud83d\ude4f Acknowledgments\r\n\r\n- Built with [PyO3](https://github.com/PyO3/pyo3)\r\n- Powered by [Hyper](https://github.com/hyperium/hyper)\r\n\r\n---\r\n\r\n<p align=\"center\">Made with \u2764\ufe0f by <a href=\"https://github.com/theoneandonlyacatto\">acatto</a></p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A fast HTTP client implementation in Rust for Python",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/theoneandonlyacatto/sharphttp"
    },
    "split_keywords": [
        "http",
        " client",
        " async",
        " rust"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "102533d79cb638d965352f92bff1338ca7673b6521ff691d9368f5f5064ef1ae",
                "md5": "52102d5879030d02456a00f19b8b2416",
                "sha256": "b7550fbcf597da6a4a5923a128d4b1f1abee0a63fc6e71c55612be468e60b428"
            },
            "downloads": -1,
            "filename": "sharphttp-0.3.0-cp312-none-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "52102d5879030d02456a00f19b8b2416",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 1676139,
            "upload_time": "2024-11-24T00:13:15",
            "upload_time_iso_8601": "2024-11-24T00:13:15.772428Z",
            "url": "https://files.pythonhosted.org/packages/10/25/33d79cb638d965352f92bff1338ca7673b6521ff691d9368f5f5064ef1ae/sharphttp-0.3.0-cp312-none-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-24 00:13:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "theoneandonlyacatto",
    "github_project": "sharphttp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "sharphttp"
}
        
Elapsed time: 0.62302s