/aiohttp-raw

Use aiohttp to send HTTP raw sockets (To Test RFC Compliance)

Primary LanguagePythonApache License 2.0Apache-2.0

aiohttp-raw

PyPI version Downloads PyPI - Python Version

Use aiohttp to send HTTP raw sockets (To Test RFC Compliance)

Logo

Usage

import asyncio
import aiohttp_raw


async def main():
    req = b"GET /get HTTP/1.1\r\nHost: httpbin.org\r\n\r\n"
    async with aiohttp_raw.ClientSession() as session:
        async with session.raw("http://httpbin.org/get", data=req) as response:
            print(await response.text())

loop = asyncio.new_event_loop()
loop.run_until_complete(main())

Installation

Prerequisites

  • Python 3.8+
pip3 install aiohttp-raw
# speedups
pip install aiohttp[speedups]
# socks
pip install aiohttp[socks]
# speedups-socks
pip install aiohttp[speedups-socks]