web3-proxy


Nameweb3-proxy JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummarySOCKS5 & more proxy providers for web3py.
upload_time2024-08-03 00:39:06
maintainerNone
docs_urlNone
authorBlackCatDevel0per
requires_python<4.0,>=3.8.1
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Usage:

```python
from __future__ import annotations

import asyncio
import sys
from os import environ as os_env

from python_socks import ProxyType
from web3 import AsyncWeb3

from web3_proxy import AdvAsyncHTTPProvider


async def main() -> None:
	# NOTE: You can parse using func from `aiohttp_socks` lib
	addr = os_env['PADDR']
	logpass = os_env['PLOGPASS']

	phost, pport = addr.split(':')
	puser, ppasswd = logpass.split(':')

	print('Connecting to:', phost, pport, puser, ppasswd)
	provider = AdvAsyncHTTPProvider(
		endpoint_uri='https://eth.drpc.org',
		proxy_conn_kwargs={
			# 'proxy_type': ProxyType.HTTP,
			'proxy_type': ProxyType.SOCKS5,
			'host': phost,
			'port': pport,
			'username': puser,
			'password': ppasswd,
		},
	)

	w3 = AsyncWeb3(provider)

	block_number = await w3.eth.get_block_number()
	print(f'Block number is {block_number}')

	# NOTE: You can have warning of unclosed session after execution end
	#       due internal proxy connector..


if __name__ == '__main__':
	async_loop = asyncio.get_event_loop()
	async_loop.run_until_complete(main())

	print('Complete!')

```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "web3-proxy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "BlackCatDevel0per",
    "author_email": "bcdev@mail.ru",
    "download_url": "https://files.pythonhosted.org/packages/c6/2b/e09260432a75d8d79d544d2e95b267044a765751e62af0f499ca775c09a2/web3_proxy-0.0.1.tar.gz",
    "platform": null,
    "description": "## Usage:\n\n```python\nfrom __future__ import annotations\n\nimport asyncio\nimport sys\nfrom os import environ as os_env\n\nfrom python_socks import ProxyType\nfrom web3 import AsyncWeb3\n\nfrom web3_proxy import AdvAsyncHTTPProvider\n\n\nasync def main() -> None:\n\t# NOTE: You can parse using func from `aiohttp_socks` lib\n\taddr = os_env['PADDR']\n\tlogpass = os_env['PLOGPASS']\n\n\tphost, pport = addr.split(':')\n\tpuser, ppasswd = logpass.split(':')\n\n\tprint('Connecting to:', phost, pport, puser, ppasswd)\n\tprovider = AdvAsyncHTTPProvider(\n\t\tendpoint_uri='https://eth.drpc.org',\n\t\tproxy_conn_kwargs={\n\t\t\t# 'proxy_type': ProxyType.HTTP,\n\t\t\t'proxy_type': ProxyType.SOCKS5,\n\t\t\t'host': phost,\n\t\t\t'port': pport,\n\t\t\t'username': puser,\n\t\t\t'password': ppasswd,\n\t\t},\n\t)\n\n\tw3 = AsyncWeb3(provider)\n\n\tblock_number = await w3.eth.get_block_number()\n\tprint(f'Block number is {block_number}')\n\n\t# NOTE: You can have warning of unclosed session after execution end\n\t#       due internal proxy connector..\n\n\nif __name__ == '__main__':\n\tasync_loop = asyncio.get_event_loop()\n\tasync_loop.run_until_complete(main())\n\n\tprint('Complete!')\n\n```",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "SOCKS5 & more proxy providers for web3py.",
    "version": "0.0.1",
    "project_urls": {
        "Documentation": "https://github.com/BlackCatDevel0per/web3-proxy",
        "Homepage": "https://github.com/BlackCatDevel0per/web3-proxy",
        "Repository": "https://github.com/BlackCatDevel0per/web3-proxy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c20ec833b716b7747923125eddbf4a8cc76c93aab6a5d9453089e7b63e1ff60",
                "md5": "d2e71b12d3054cf526a89bdcfc17c552",
                "sha256": "593e0049eb67306b9b410701e2f5540577ee711a1fdff04eb100d03706c00605"
            },
            "downloads": -1,
            "filename": "web3_proxy-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d2e71b12d3054cf526a89bdcfc17c552",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 12793,
            "upload_time": "2024-08-03T00:39:04",
            "upload_time_iso_8601": "2024-08-03T00:39:04.954415Z",
            "url": "https://files.pythonhosted.org/packages/2c/20/ec833b716b7747923125eddbf4a8cc76c93aab6a5d9453089e7b63e1ff60/web3_proxy-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c62be09260432a75d8d79d544d2e95b267044a765751e62af0f499ca775c09a2",
                "md5": "086996ef364057f883efa91a6ec675b5",
                "sha256": "ec323c3593d45bc2b3fb0fce71cecdd5a915517e8bf711e72d446ff2e5189525"
            },
            "downloads": -1,
            "filename": "web3_proxy-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "086996ef364057f883efa91a6ec675b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 11639,
            "upload_time": "2024-08-03T00:39:06",
            "upload_time_iso_8601": "2024-08-03T00:39:06.978269Z",
            "url": "https://files.pythonhosted.org/packages/c6/2b/e09260432a75d8d79d544d2e95b267044a765751e62af0f499ca775c09a2/web3_proxy-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-03 00:39:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BlackCatDevel0per",
    "github_project": "web3-proxy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "web3-proxy"
}
        
Elapsed time: 3.73005s