Skip to main content

simple proxy class

Project description

proxy-handler

A simple proxy class with built-in support for proxy authentication and connection testing

Installation

pip install proxy-handler

Examples

Create a proxy

from proxy import Proxy, ProxyType

# Proxy without authentication
proxy = Proxy.from_host_colon_port("host:port", ProxyType.SOCKS5)

# Proxy with authentication
proxy2 = Proxy.from_host_port_colon_user_pass("host:port:user:pass", ProxyType.HTTP)

Check connection

from proxy import Proxy, ProxyType
import asyncio

proxy = Proxy.from_host_colon_port("host:port", ProxyType.SOCKS5)

# check_connection is an async method, so we use asyncio.run()
connection = asyncio.run(proxy.check_connection())

print(connection)

Flexible formats

from proxy import Proxy, ProxyType
import asyncio

proxy = Proxy.from_host_colon_port("host:port", ProxyType.SOCKS5)

proxy.host_at_port() # e.g., 'socks5://host@port'
proxy.host_colon_port() # e.g., 'socks5://host:port'
proxy.host_port_at_user_pass() # e.g., 'socks5://host:port@user:pass'

Error handling

from proxy import Proxy, ProxyType, InvalidProxyFormatException

try:
    proxy = Proxy.from_host_colon_port("host@port", ProxyType.SOCKS5)
except InvalidProxyFormatException as e:
    print(f"Error - {e}")

This project, proxy-handler, is licensed under the MIT License.
See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxy_handler-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxy_handler-1.0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file proxy_handler-1.0.1.tar.gz.

File metadata

  • Download URL: proxy_handler-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for proxy_handler-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c271074f711fa12ff1e28a66c3ddc7372cd5c1b25259c86647c81a281761f9e0
MD5 70cbfa49e4bab9b9ac22c3b96f0f4777
BLAKE2b-256 3a35fa54e0c9ff8071f31403ebbb0a53e7199ac89e27f34721db9067cf17c82a

See more details on using hashes here.

File details

Details for the file proxy_handler-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: proxy_handler-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for proxy_handler-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a5f96ba0cfc82462502706884758ef47429153a9f1dbbe684752c021e108583
MD5 12f69158c251a7493be64eb993e68128
BLAKE2b-256 1613f59a0ddec8e9d58dc4bd855579a6dda10f3252da05e58133ce2ce6173755

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page