Better proxy!
Project description
Better Proxy
Представление такой сущности, как proxy в виде класса.
- Метод
Proxy.from_str()
поддерживает большинство форматом прокси (с протоколом и без):host:port:login:password host:port@login:password host:port|login:password login:password@host:port login:password:host:port host:port
- Реализованы методы
__hash__
и__eq__
, что позволяет засовывть прокси в set() - Метод
Proxy.from_file()
возвращает список прокси из файла по указанному пути
pip install better-proxy
More libraries of the family:
aiohttp
import aiohttp
from better_proxy import Proxy
from aiohttp_socks import ProxyConnector
proxy = Proxy.from_str("socks5://user:password@127.0.0.1:1080")
async def fetch(url):
connector = ProxyConnector.from_url(proxy.as_url)
async with aiohttp.ClientSession(connector=connector) as session:
async with session.get(url) as response:
return await response.text()
requests
import requests
from better_proxy import Proxy
proxy = Proxy.from_str("http://user:password@host:port")
def fetch(url):
response = requests.get(url, proxies=proxy.as_proxies_dict)
return response.text
playwright
from playwright.async_api import async_playwright, Playwright
from better_proxy import Proxy
proxy = Proxy.from_str("http://user:password@host:port")
async def fetch(playwright: Playwright, url):
chromium = playwright.chromium
browser = await chromium.launch(proxy=proxy.as_playwright_proxy)
...
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
better_proxy-1.2.0.tar.gz
(3.4 kB
view details)
Built Distribution
File details
Details for the file better_proxy-1.2.0.tar.gz
.
File metadata
- Download URL: better_proxy-1.2.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f26f8fa09156e00c7c11f44480307181f143653ec8b5c937dbf8cbd40e39360 |
|
MD5 | 68ed3b0a0cc18badf3a2bd4d671fc41e |
|
BLAKE2b-256 | 7a254191e75fbba5d5576da36572613cbe138c16352c10d13776a329c1b867f5 |
File details
Details for the file better_proxy-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: better_proxy-1.2.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c22fc264d6543b6f26804a5b3d6278010a98c54421e71adf0d50a6e936e8d62 |
|
MD5 | c71fa11d1f826a17a198304efb4a46a5 |
|
BLAKE2b-256 | 7631500e7f1e65b42f23ced04ec6b5230677b5c1bf398bd18015ad850a9e4687 |