A simple and quick way to get a proxy.
Project description
Documentation in Russian
pip install EasyProxies
См. также https://www.proxyscan.io/api
Пример использования
Напечатает до 20-и прокси ip:port каждый с новой строки:
from EasyProxies import *
my_filters = filters.TypeHTTP | filters.TypeHTTPS # HTTP или HTTPS прокси
my_filters &= filters.Ping(10) & filters.Uptime(10) # Пинг не больше 100 и Время безотказной работы 10%
print(*Proxies.get((my_filters & filters.Limit(20))), sep='\n')
тоже самое что и
from EasyProxies import *
print(*Proxies.get(type='http,https', ping=10, uptime=10, limit=20), sep='\n')
# __init__.py
from typing import Union
from EasyProxies import filters
__all__ = ('Proxies', 'filters')
ParamsType = dict[str, Union[str, int]]
ListOfProxy = list[Union[dict[str, Union[str, int, type(None)]], str]]
DEFAULT_FILTERS: filters.Filter = filters.FormatTXT
class Proxies:
HOST = 'https://www.proxyscan.io/'
def __init__(self, default: filters.Filter, host: str = HOST):
"""Задаёт фильтры по умолчанию, меняет хост"""
...
@classmethod
def raw_request(cls, params: Union[ParamsType, str]) -> ListOfProxy: ...
@classmethod
def get(cls, filters: Union[filters.Filter, ParamsType, str] = DEFAULT_FILTERS) -> ListOfProxy: ...
@classmethod
def download_type(cls, protocol: filters.Type) -> list[str]:
"""Вернёт список готовых прокси"""
...
Фильтры
Пакет EasyProxy.filters
.
from abc import ABC, abstractmethod
from typing import Any, Union
class Filter(ABC):
__slots__ = ('value', 'as_dict')
key = classmethod(property(...))
@abstractmethod
def value_validator(self, value): pass
def __init__(self, *value, joins: dict = None): ...
def __and__(self, other): ... # &
def __bool__(self) -> bool: ...
def __eq__(self, other) -> bool: ...
def __str__(self) -> str: ...
class limitedValues(Filter):
values = ...
class limitedStringCaseInsensitive(limitedValues):
def __or__(self, other: limitedValues): ... # |
class Number(limitedValues):
values = None
def value_validator(self, value): ...
class CC(Filter): ...
class Format(limitedStringCaseInsensitive):
values = ('json', 'txt')
class Level(limitedStringCaseInsensitive):
values = ('transparent', 'anonymous', 'elite')
class Type(limitedStringCaseInsensitive):
values = ('http', 'https', 'socks4', 'socks5')
class LastCheck(Number): ...
class Port(Number): ...
class Ping(Number): ...
class Limit(Number): values = range(1, 21)
class Uptime(Number): values = range(1, 101)
class Country(CC): ...
class NotCountry(CC): ...
ALL_FILTERS = [Format, Level, Type, LastCheck, Port, Ping, Limit, Uptime, Country, NotCountry]
def dict_to_filter(flt: Union[dict[str, Any], Filter] = None, **kwargs
) -> Filter: ...
# Псевдонимы
Protocol = Type
Last_Check = LastCheck
Not_Country = NotCountry
FormatJSON, FormatTXT = ...
TypeHTTP, TypeHTTPS, TypeSOCKS4, TypeSOCKS5 = ...
LevelTRANSPARENT, LevelANONYMOUS, LevelELITE = ...
TypeSOCKS = Type('socks4', 'socks5')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
EasyProxies-0.1.5.tar.gz
(5.1 kB
view details)
Built Distribution
File details
Details for the file EasyProxies-0.1.5.tar.gz
.
File metadata
- Download URL: EasyProxies-0.1.5.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26a809109f1bb4dbf43fe545e4ea65bd923184f556046f3f49a0250ebc5886dc |
|
MD5 | 55e3a642132c4787d1cf2ea6da0eee50 |
|
BLAKE2b-256 | de08f432ad62909f2bb9d23b10ef88d584c4add35e412078bf3f6dec7a1be79f |
File details
Details for the file EasyProxies-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: EasyProxies-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a69a63955fb28366fd459e363527a5412131ac06a26c8bd9dbcead33b22b6318 |
|
MD5 | 0f25cf5243153a32376afd5c75f95196 |
|
BLAKE2b-256 | 0f03f1a8f78035e9e24818faaa771c28ea273412bc100652bb873cc9b5e6ccfd |