Skip to content

Releases: davidteather/proxyproviders

V0.2.1 - Playwright Format Support

05 Oct 21:35
ddcc822

Choose a tag to compare

• Added ProxyFormat.PLAYWRIGHT with protocol handling
• Enhanced error validation for invalid input types

What's Changed

Full Changelog: v0.2.0...V0.2.1

V0.2.0 - Add Algorithms for Proxy Selection + Built-In Proxy Formatter

20 Sep 07:09
63e3834

Choose a tag to compare

🎯 Algorithm-Based Proxy Selection

  • New get_proxy() method with Random, RoundRobin, and First algorithms
  • Custom algorithm support - extend Algorithm base class for custom selection logic
  • Stateful selection - RoundRobin maintains position across calls
  from proxyproviders import Webshare
  from proxyproviders.algorithms import Random, RoundRobin

  provider = Webshare(api_key="your-key")

  # Default RoundRobin cycles through proxies
  proxy = provider.get_proxy()

  # Random selection
  proxy = provider.get_proxy(Random())

  # Reusable algorithm with state
  round_robin = RoundRobin()
  proxy1 = provider.get_proxy(round_robin)
  proxy2 = provider.get_proxy(round_robin)  # Next in sequence

🔧 Universal Proxy Formatting

  • ProxyFormat enum supporting REQUESTS, CURL, HTTPX, AIOHTTP, URL
  • proxy.format() method converts to any client format
  • One-liner requests possible
  from proxyproviders.models.proxy import ProxyFormat
  import requests

  # One-liner HTTP request through proxy
  requests.get("https://httpbin.org/ip",
              proxies=provider.get_proxy().format(ProxyFormat.REQUESTS))

  # Different formats for different clients
  proxy.format(ProxyFormat.CURL)     # ["-x", "http://user:pass@host:port"]
  proxy.format(ProxyFormat.HTTPX)    # {"http://": "...", "https://": "..."}
  proxy.format()                     # "http://user:pass@host:port" (default)

Was hoping to release this not at 2am, but got paged and can't sleep until released 😤

V0.1.1 - Initial Release With Support for WebShare, BrightData

18 Feb 03:12

Choose a tag to compare

Welcome to the start of this new project! This project provides an easy to use interface for interacting with many different proxy providers under the hood through the ProxyProvider abstraction.

I intend to integrate this into the TikTokAPI repository within the next few weeks to allow people to use existing and develop their own proxy providers through this.

Here's a quick example of the shared abstraction if anyone's just looking at the release and not the docs

from proxyproviders import Webshare, BrightData, ProxyProvider
import requests
import os


def request_with_proxy(provider: ProxyProvider):
    requests_proxy = None
    if provider:
        proxies = provider.list_proxies()
        requests_proxy = {
            "http": f"http://{proxies[0].username}:{proxies[0].password}@{proxies[0].proxy_address}:{proxies[0].port}",
            "https": f"http://{proxies[0].username}:{proxies[0].password}@{proxies[0].proxy_address}:{proxies[0].port}",
        }
    r = requests.get("https://httpbin.org/ip", proxies=requests_proxy)
    return r.json()

webshare = Webshare(api_key=os.getenv("WEBSHARE_API_KEY"))
brightdata = BrightData(api_key=os.getenv("BRIGHTDATA_API_KEY"), zone="my_zone")

print(f"Your IP: {request_with_proxy(None)}")
print(f"Webshare: {request_with_proxy(webshare)}")
print(f"BrightData: {request_with_proxy(brightdata)}")
==================================================================================================== test session starts =====================================================================================================
platform darwin -- Python 3.11.2, pytest-8.3.4, pluggy-1.5.0
configfile: pyproject.toml
collected 21 items                                                                                                                                                                                                           

tests/integration/test_brightdata_integration.py .                                                                                                                                                                     [  4%]
tests/integration/test_webshare_integration.py .                                                                                                                                                                       [  9%]
tests/providers/test_brightdata.py ......                                                                                                                                                                              [ 38%]
tests/providers/test_webshare.py .......                                                                                                                                                                               [ 71%]
tests/test_exceptions.py ..                                                                                                                                                                                            [ 80%]
tests/test_proxy_provider.py ....                                                                                                                                                                                      [100%]

===================================================================================================== 21 passed in 2.57s =====================================================================================================
Name                                     Stmts   Miss Branch BrPart  Cover
--------------------------------------------------------------------------
proxyproviders/__init__.py                   5      0      0      0   100%
proxyproviders/exceptions.py                16      0      0      0   100%
proxyproviders/models/__init__.py            0      0      0      0   100%
proxyproviders/models/proxy.py              23      0      0      0   100%
proxyproviders/providers/brightdata.py      53      2     10      1    95%
proxyproviders/providers/webshare.py        46      0      6      0   100%
proxyproviders/proxy_provider.py            38      1      8      0    98%
--------------------------------------------------------------------------
TOTAL                                      181      3     24      1    98%