aiohttp-socks


Nameaiohttp-socks JSON
Version 0.10.1 PyPI version JSON
download
home_pageNone
SummaryProxy connector for aiohttp
upload_time2024-12-26 07:06:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8.0
licenseApache-2.0
keywords asyncio aiohttp socks socks5 socks4 http proxy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ## aiohttp-socks

[![CI](https://github.com/romis2012/aiohttp-socks/actions/workflows/ci.yml/badge.svg)](https://github.com/romis2012/aiohttp-socks/actions/workflows/ci.yml)
[![Coverage Status](https://codecov.io/gh/romis2012/aiohttp-socks/branch/master/graph/badge.svg)](https://codecov.io/gh/romis2012/aiohttp-socks)
[![PyPI version](https://badge.fury.io/py/aiohttp-socks.svg)](https://pypi.python.org/pypi/aiohttp-socks)
<!--
[![Downloads](https://pepy.tech/badge/aiohttp-socks/month)](https://pepy.tech/project/aiohttp-socks)
-->
The `aiohttp-socks` package provides a proxy connector for [aiohttp](https://github.com/aio-libs/aiohttp). 
Supports SOCKS4(a), SOCKS5(h), HTTP (tunneling) as well as Proxy chains.
It uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality.


## Requirements
- Python >= 3.8
- aiohttp >= 3.10.0
- python-socks[asyncio] >= 2.4.3

## Installation
```
pip install aiohttp_socks
```

## Usage

#### aiohttp usage:
```python
import aiohttp
from aiohttp_socks import ProxyType, ProxyConnector, ChainProxyConnector


async def fetch(url):
    connector = ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080')
    
    ### or use ProxyConnector constructor
    # connector = ProxyConnector(
    #     proxy_type=ProxyType.SOCKS5,
    #     host='127.0.0.1',
    #     port=1080,
    #     username='user',
    #     password='password',
    #     rdns=True # default is True for socks5
    # )
    
    ### proxy chaining (since ver 0.3.3)
    # connector = ChainProxyConnector.from_urls([
    #     'socks5://user:password@127.0.0.1:1080',
    #     'socks4://127.0.0.1:1081',
    #     'http://user:password@127.0.0.1:3128',
    # ])
    async with aiohttp.ClientSession(connector=connector) as session:
        async with session.get(url) as response:
            return await response.text()
```

## Why yet another SOCKS connector for aiohttp

Unlike [aiosocksy](https://github.com/romis2012/aiosocksy), aiohttp_socks has only single point of integration with aiohttp. 
This makes it easier to maintain compatibility with new aiohttp versions.



            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aiohttp-socks",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8.0",
    "maintainer_email": null,
    "keywords": "asyncio, aiohttp, socks, socks5, socks4, http, proxy",
    "author": null,
    "author_email": "Roman Snegirev <snegiryev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/25/c0/dfc948c2aff58db2846192d744dc889bd634b9f3cc7d0fca85ef3c7e9cd4/aiohttp_socks-0.10.1.tar.gz",
    "platform": null,
    "description": "## aiohttp-socks\n\n[![CI](https://github.com/romis2012/aiohttp-socks/actions/workflows/ci.yml/badge.svg)](https://github.com/romis2012/aiohttp-socks/actions/workflows/ci.yml)\n[![Coverage Status](https://codecov.io/gh/romis2012/aiohttp-socks/branch/master/graph/badge.svg)](https://codecov.io/gh/romis2012/aiohttp-socks)\n[![PyPI version](https://badge.fury.io/py/aiohttp-socks.svg)](https://pypi.python.org/pypi/aiohttp-socks)\n<!--\n[![Downloads](https://pepy.tech/badge/aiohttp-socks/month)](https://pepy.tech/project/aiohttp-socks)\n-->\nThe `aiohttp-socks` package provides a proxy connector for [aiohttp](https://github.com/aio-libs/aiohttp). \nSupports SOCKS4(a), SOCKS5(h), HTTP (tunneling) as well as Proxy chains.\nIt uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality.\n\n\n## Requirements\n- Python >= 3.8\n- aiohttp >= 3.10.0\n- python-socks[asyncio] >= 2.4.3\n\n## Installation\n```\npip install aiohttp_socks\n```\n\n## Usage\n\n#### aiohttp usage:\n```python\nimport aiohttp\nfrom aiohttp_socks import ProxyType, ProxyConnector, ChainProxyConnector\n\n\nasync def fetch(url):\n    connector = ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080')\n    \n    ### or use ProxyConnector constructor\n    # connector = ProxyConnector(\n    #     proxy_type=ProxyType.SOCKS5,\n    #     host='127.0.0.1',\n    #     port=1080,\n    #     username='user',\n    #     password='password',\n    #     rdns=True # default is True for socks5\n    # )\n    \n    ### proxy chaining (since ver 0.3.3)\n    # connector = ChainProxyConnector.from_urls([\n    #     'socks5://user:password@127.0.0.1:1080',\n    #     'socks4://127.0.0.1:1081',\n    #     'http://user:password@127.0.0.1:3128',\n    # ])\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(url) as response:\n            return await response.text()\n```\n\n## Why yet another SOCKS connector for aiohttp\n\nUnlike [aiosocksy](https://github.com/romis2012/aiosocksy), aiohttp_socks has only single point of integration with aiohttp. \nThis makes it easier to maintain compatibility with new aiohttp versions.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Proxy connector for aiohttp",
    "version": "0.10.1",
    "project_urls": {
        "homepage": "https://github.com/romis2012/aiohttp-socks",
        "repository": "https://github.com/romis2012/aiohttp-socks"
    },
    "split_keywords": [
        "asyncio",
        " aiohttp",
        " socks",
        " socks5",
        " socks4",
        " http",
        " proxy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d3047ff144f7465e83cf87459ffd74688871918496acd4816507cca1af5623d3",
                "md5": "9d9cf924cb7cd212587f5c647e76d123",
                "sha256": "6fd4d46c09f952f971a011ff446170daab8d539cf5310c0627f8423df2fb15ea"
            },
            "downloads": -1,
            "filename": "aiohttp_socks-0.10.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d9cf924cb7cd212587f5c647e76d123",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.0",
            "size": 10119,
            "upload_time": "2024-12-26T07:06:22",
            "upload_time_iso_8601": "2024-12-26T07:06:22.236390Z",
            "url": "https://files.pythonhosted.org/packages/d3/04/7ff144f7465e83cf87459ffd74688871918496acd4816507cca1af5623d3/aiohttp_socks-0.10.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25c0dfc948c2aff58db2846192d744dc889bd634b9f3cc7d0fca85ef3c7e9cd4",
                "md5": "e15d0c6ce22d316a39a6bd7b3686d418",
                "sha256": "49f2e1f8051f2885719beb1b77e312b5a27c3e4b60f0b045a388f194d995e068"
            },
            "downloads": -1,
            "filename": "aiohttp_socks-0.10.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e15d0c6ce22d316a39a6bd7b3686d418",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.0",
            "size": 10445,
            "upload_time": "2024-12-26T07:06:26",
            "upload_time_iso_8601": "2024-12-26T07:06:26.244712Z",
            "url": "https://files.pythonhosted.org/packages/25/c0/dfc948c2aff58db2846192d744dc889bd634b9f3cc7d0fca85ef3c7e9cd4/aiohttp_socks-0.10.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-26 07:06:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "romis2012",
    "github_project": "aiohttp-socks",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "aiohttp-socks"
}
        
Elapsed time: 0.57374s