Description
free-ssl-proxies is a lightweight Python library that scrapes ssl proxies from https://sslproxies.org/,
and provides some convenient objects and caching methods for working with the retrieved proxies. This library
requires no external Python dependencies to work.
Usage
Installation
pip3 install .
Importing
from free_ssl_proxies import proxy_list as pl
First time retrieval
You can iterate through all the proxies currently available on sslproxies.org with the following code:
profile: If True, we will attempt to connect through each proxytimeout: If the timeout is exceeded the proxy object will containNonefor theavg_request_time(relatively slow proxy)
proxies = pl.ProxyList.from_ssl_proxies_org(profile=True, timeout=1)
for proxy in proxies:
print(proxy.ip_address, proxy.port, proxy.cc, proxy.country, proxy.google, proxy.avg_request_time)
Caching
sslproxies.org refreshes their list every 10 minutes, so it doesn't make sense to constantly hammer their page with
requests. This package offers a simple caching mechanism that can be used like so:
proxies = pl.ProxyList.from_ssl_proxies_org(profile=True, timeout=1)
pl.write_proxy_list_to_cache(proxies)
To access the cache later:
proxies = pl.ProxyList.from_cache()
Access
By country
You can use either the country name cc to find proxies.
for us_proxy in proxies.get_by_country("us"):
print(us_proxy)
Fastest
You can get a sorted list of the fastest proxies if profiling has been done.
for fast_proxy in proxies.get_fastest():
print(fast_proxy)
Random
You can get a random proxy selected from the fastest proxies if profiling has been done. If profiling has not been done then we will pick from the entire pool of available proxies.
proxy = proxies.random()
Metadata
Release files for free-ssl-proxies 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| free_ssl_proxies-0.1.1.tar.gz | 5.5 kB | Details |
Release files / free_ssl_proxies-0.1.1.tar.gz
| Download URL | free_ssl_proxies-0.1.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec41b8c2faf4a43ea51e85d96e86bb69f5b37b6034e700a03b9f4fd7aaacbd3a
|
|
BLAKE2b-256 checksum How to use checksums |
09ff518f4014b7048ab70f951a5db8bb8bd7c360575f437ffd8f5c3c247ff443
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.6
|