Skip to main content

A package to check the validity of proxies.

Project description

validproxy 2.0.0

validproxy is a robust and efficient Python package designed to streamline the process of validating proxy servers. It supports multiple proxy types including HTTP, HTTPS, SOCKS4, and SOCKS5. This package is ideal for developers who need to ensure that only valid proxies are used in their applications, enhancing reliability and performance.

Features

  • Multiple Proxy Support: Validate HTTP, HTTPS, SOCKS4, and SOCKS5 proxies.
  • File Handling: Easily read proxies from a file.
  • Validation and Storage: Validate proxies and save the valid ones to a separate file.
  • Simple Interface: Easy to integrate and use within your existing projects.

Benefits

  • Efficiency : Quickly validate large lists of proxies.
  • Automation : Easily integrate proxy validation into automated workflows and scripts.
  • Reliability : Ensure only valid proxies are used, improving the reliability of your applications.

Installation

You can install validproxy using pip:

pip install validproxy

Usage

Example 1: Check Proxies from a File Without Saving

This example demonstrates how to read a list of proxies from a file, check their validity, and print the results.

from validproxy import validproxy

def read_proxies_from_file(file_path):
    with open(file_path, 'r') as file:
        proxies = [line.strip() for line in file if line.strip()]
    return proxies

def main():
    proxy_list = "proxy.txt"
    proxies = read_proxies_from_file(proxy_list)

    valid_proxies = []

    for proxy in proxies:
        if validproxy(proxy):
            print(f'Valid proxy: {proxy}')
            valid_proxies.append(proxy)
        else:
            print(f'Invalid proxy: {proxy}')

if __name__ == "__main__":
    main()

Explanation

  • read_proxies_from_file(file_path) : Reads proxies from the specified file.
  • validproxy(proxy) : Checks if the given proxy is valid.
  • Main Logic : Iterates through the list of proxies, validates each, and prints the result.

Example 2: Check Proxies from a File and Save Valid Proxies

This example extends the previous one by also saving the valid proxies to a separate file.

from validproxy import validproxy

def read_proxies_from_file(file_path):
    with open(file_path, 'r') as file:
        proxies = [line.strip() for line in file if line.strip()]
    return proxies

def save_valid_proxies(file_path, valid_proxies):
    with open(file_path, 'w') as file:
        for proxy in valid_proxies:
            file.write(f"{proxy}\n")

def main():
    proxy_list = "proxy.txt"
    valid_proxy_save = "valid_proxy.txt"
    proxies = read_proxies_from_file(proxy_list)

    valid_proxies = []

    for proxy in proxies:
        if validproxy(proxy):
            print(f'Valid proxy: {proxy}')
            valid_proxies.append(proxy)
        else:
            print(f'Invalid proxy: {proxy}')

    save_valid_proxies(valid_proxy_save, valid_proxies)

if __name__ == "__main__":
    main()

Explanation

  • save_valid_proxies(file_path, valid_proxies) : Saves the list of valid proxies to the specified file.
  • Main Logic : Reads proxies, validates them, prints the results, and saves valid proxies.

Example 3: Check a Single Proxy

This example shows how to validate a single proxy.

from validproxy import validproxy

proxy = "http://102.38.31.8:9999"

if validproxy(proxy):
    print(f'Valid proxy: {proxy}')
else:
    print(f'Invalid proxy: {proxy}')

Explanation

  • Single Proxy Check : Simply validates a single proxy and prints whether it's valid or not.

Thanks

  • Thank you for using validproxy. Your support and feedback are greatly appreciated. If you find this package helpful, please consider contributing, providing feedback, or simply spreading the word. Together, we can make proxy validation easier and more efficient for everyone.

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

validproxy-2.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

validproxy-2.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file validproxy-2.0.0.tar.gz.

File metadata

  • Download URL: validproxy-2.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for validproxy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 01116f0b7f717832ab7984dffae66e9af839a959f2e8eef9a5d92dc4ea1c80b7
MD5 27bfd3619e51741d1644f8f45e2479fe
BLAKE2b-256 7a8c25b27ebceb6c31b29d4bd61baa1e3e87d8c3e15d85f2ed2be9469947e785

See more details on using hashes here.

File details

Details for the file validproxy-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: validproxy-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for validproxy-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f14f4ec80fa52c5a15c63bb1d11f0bb6b441770fdc8098dbbc85dde6c5a0af62
MD5 547f1a0d519ad1e700981456c22586cb
BLAKE2b-256 1e486448f3f0797e8e90f501de010fff84af006cb83e4d31c74d86a7300c982b

See more details on using hashes here.

Supported by

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