# 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:
```bash
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.
```python
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.
```python
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.
```python
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.
Raw data
{
"_id": null,
"home_page": "https://mrfidal.in/cyber-security/validproxy",
"name": "validproxy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Fidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/7a/8c/25b27ebceb6c31b29d4bd61baa1e3e87d8c3e15d85f2ed2be9469947e785/validproxy-2.0.0.tar.gz",
"platform": null,
"description": "# validproxy 2.0.0\r\n\r\n`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.\r\n\r\n## Features\r\n\r\n- **Multiple Proxy Support:** Validate HTTP, HTTPS, SOCKS4, and SOCKS5 proxies.\r\n- **File Handling:** Easily read proxies from a file.\r\n- **Validation and Storage:** Validate proxies and save the valid ones to a separate file.\r\n- **Simple Interface:** Easy to integrate and use within your existing projects.\r\n\r\n### Benefits\r\n\r\n- Efficiency : Quickly validate large lists of proxies.\r\n- Automation : Easily integrate proxy validation into automated workflows and scripts.\r\n- Reliability : Ensure only valid proxies are used, improving the reliability of your applications.\r\n\r\n## Installation\r\n\r\nYou can install `validproxy` using pip:\r\n\r\n```bash\r\npip install validproxy\r\n```\r\n\r\n## Usage\r\n\r\n### Example 1: Check Proxies from a File Without Saving\r\n\r\nThis example demonstrates how to read a list of proxies from a file, check their validity, and print the results.\r\n\r\n```python\r\nfrom validproxy import validproxy\r\n\r\ndef read_proxies_from_file(file_path):\r\n with open(file_path, 'r') as file:\r\n proxies = [line.strip() for line in file if line.strip()]\r\n return proxies\r\n\r\ndef main():\r\n proxy_list = \"proxy.txt\"\r\n proxies = read_proxies_from_file(proxy_list)\r\n\r\n valid_proxies = []\r\n\r\n for proxy in proxies:\r\n if validproxy(proxy):\r\n print(f'Valid proxy: {proxy}')\r\n valid_proxies.append(proxy)\r\n else:\r\n print(f'Invalid proxy: {proxy}')\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n\r\n### Explanation\r\n- `read_proxies_from_file(file_path)` : Reads proxies from the specified file.\r\n- `validproxy(proxy)` : Checks if the given proxy is valid.\r\n- **Main Logic** : Iterates through the list of proxies, validates each, and prints the result.\r\n\r\n### Example 2: Check Proxies from a File and Save Valid Proxies\r\nThis example extends the previous one by also saving the valid proxies to a separate file.\r\n\r\n```python\r\nfrom validproxy import validproxy\r\n\r\ndef read_proxies_from_file(file_path):\r\n with open(file_path, 'r') as file:\r\n proxies = [line.strip() for line in file if line.strip()]\r\n return proxies\r\n\r\ndef save_valid_proxies(file_path, valid_proxies):\r\n with open(file_path, 'w') as file:\r\n for proxy in valid_proxies:\r\n file.write(f\"{proxy}\\n\")\r\n\r\ndef main():\r\n proxy_list = \"proxy.txt\"\r\n valid_proxy_save = \"valid_proxy.txt\"\r\n proxies = read_proxies_from_file(proxy_list)\r\n\r\n valid_proxies = []\r\n\r\n for proxy in proxies:\r\n if validproxy(proxy):\r\n print(f'Valid proxy: {proxy}')\r\n valid_proxies.append(proxy)\r\n else:\r\n print(f'Invalid proxy: {proxy}')\r\n\r\n save_valid_proxies(valid_proxy_save, valid_proxies)\r\n\r\nif __name__ == \"__main__\":\r\n main()\r\n```\r\n### Explanation\r\n- `save_valid_proxies(file_path, valid_proxies)` : Saves the list of valid proxies to the specified file.\r\n- **Main Logic** : Reads proxies, validates them, prints the results, and saves valid proxies.\r\n \r\n### Example 3: Check a Single Proxy\r\n\r\nThis example shows how to validate a single proxy.\r\n\r\n```python\r\nfrom validproxy import validproxy\r\n\r\nproxy = \"http://102.38.31.8:9999\"\r\n\r\nif validproxy(proxy):\r\n print(f'Valid proxy: {proxy}')\r\nelse:\r\n print(f'Invalid proxy: {proxy}')\r\n```\r\n### Explanation\r\n\r\n- Single Proxy Check : Simply validates a single proxy and prints whether it's valid or not.\r\n \r\n### Thanks\r\n- 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.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A package to check the validity of proxies.",
"version": "2.0.0",
"project_urls": {
"Homepage": "https://mrfidal.in/cyber-security/validproxy"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e486448f3f0797e8e90f501de010fff84af006cb83e4d31c74d86a7300c982b",
"md5": "547f1a0d519ad1e700981456c22586cb",
"sha256": "f14f4ec80fa52c5a15c63bb1d11f0bb6b441770fdc8098dbbc85dde6c5a0af62"
},
"downloads": -1,
"filename": "validproxy-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "547f1a0d519ad1e700981456c22586cb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3988,
"upload_time": "2024-07-05T14:40:10",
"upload_time_iso_8601": "2024-07-05T14:40:10.547751Z",
"url": "https://files.pythonhosted.org/packages/1e/48/6448f3f0797e8e90f501de010fff84af006cb83e4d31c74d86a7300c982b/validproxy-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a8c25b27ebceb6c31b29d4bd61baa1e3e87d8c3e15d85f2ed2be9469947e785",
"md5": "27bfd3619e51741d1644f8f45e2479fe",
"sha256": "01116f0b7f717832ab7984dffae66e9af839a959f2e8eef9a5d92dc4ea1c80b7"
},
"downloads": -1,
"filename": "validproxy-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "27bfd3619e51741d1644f8f45e2479fe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3764,
"upload_time": "2024-07-05T14:40:12",
"upload_time_iso_8601": "2024-07-05T14:40:12.285425Z",
"url": "https://files.pythonhosted.org/packages/7a/8c/25b27ebceb6c31b29d4bd61baa1e3e87d8c3e15d85f2ed2be9469947e785/validproxy-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-05 14:40:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "validproxy"
}