Skip to main content

Sync & asyncio (Requests & AIOHTTP) proxy rotator + utils for actproxy API & services.

Project description

actproxy

Python package providing actproxy.com API access and proxy rotation methods for requests (synchronous) and aiohttp (asyncio). Can also be used independently. Supports socks5, http/https, and ipv4/ipv6 as per actproxy's services.

PyPI license

Quick-Start (AIOHTTP)

import actproxy
from aiohttp import ClientSession


async def main():
    actproxy_api_keys = [
        "xxxxxxxxxxxxxxxxxxxxxxxx",
        "xxxxxxxxxxxxxxxxxxxxxxxx"
    ]
    # Initialize API. Also returns your proxies.
    await actproxy.aioinit(actproxy_api_keys)
    # Use a new AIOHTTP connector which rotates & uses the next proxy.
    async with ClientSession(connector=actproxy.aiohttp_rotate()) as session:
        url = "http://dummy.restapiexample.com/api/v1/employees"
        async with session.get(url) as resp:
            if resp.status == 200:
                resp_json = await resp.json()
                print(resp_json)

Quick-Start (Requests)

import actproxy
import requests

actproxy_api_keys = [
    "xxxxxxxxxxxxxxxxxxxxxxxx",
    "xxxxxxxxxxxxxxxxxxxxxxxx"
]
# Initialize API. Also returns your proxies.
actproxy.init(actproxy_api_keys)
url = "http://dummy.restapiexample.com/api/v1/employees"
resp = requests.get(url, proxies=actproxy.rotate())
if resp.status_code == 200:
    resp_json = resp.json()
    print(resp_json)

Methods

actproxy.aioinit(api_keys: List = None, output_format: DumpFormat = 'json', get_userpass: Boolean = True) -> Union[FlatList, str, None]

Fetches your proxies from ActProxy & returns them. Must be run before the other aiohttp functions.

actproxy.init(api_keys: List[str], output_format: DumpFormat = 'json', get_userpass: Any = True) -> Union[FlatList, str, None]

Fetches your proxies from ActProxy & returns them. Must be run before the other synchronous functions.

actproxy.aiohttp_rotate(protocol: ProxyProto = return_proxy: Boolean = False) -> Union[ProxyConnector, Tuple[Data, ProxyConnector]]

Returns an aiohttp connector which uses the next proxy from your list.

actproxy.rotate(protocol: ProxyProto = 'socks5') -> Data

Returns the next proxy from your list. Return variable is suitable for use with requests[socks].

actproxy.random_proxy(protocol: ProxyProto = 'socks5') -> Data

Returns a random proxy from your list. Return variable is suitable for use with requests[socks].

actproxy.aiohttp_random(protocol: ProxyProto = 'socks5', return_proxy: Boolean = False) -> Union[ProxyConnector, Tuple[Data, ProxyConnector]]

Returns an aiohttp connector which uses uses a random proxy from your list.

actproxy.one_hot_proxy() -> Data

Similar to rotate() but returns a single proxy dict/object for use in places other than aiohttp or requests.

Changelog

0.1.6 - 10/24/2020 : Lock aiohttp version fixing aiohttp #5112

0.1.5 - 10/24/2020 : Rotator bug fix. CSV fix. Better type-hints & coverage.

0.1.4 - 10/23/2020 : Support multiple API keys. Unit tests. Fixes.

0.1.3 - 9/29/2020 : Minor fixes and addition of docstrings.

0.1.2 - 9/28/2020 : Initial release version.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

actproxy-0.1.6.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

actproxy-0.1.6-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file actproxy-0.1.6.tar.gz.

File metadata

  • Download URL: actproxy-0.1.6.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for actproxy-0.1.6.tar.gz
Algorithm Hash digest
SHA256 77744abb87c3b85c8e812be320b4ca53dbffcf4bfc777bb85d05122970a68786
MD5 d7157861668a1418400abde94903f1f2
BLAKE2b-256 1c5520f3dc067fbb966900ca5cb07f12087447887ae0e4202b56f7e957f5e8a1

See more details on using hashes here.

File details

Details for the file actproxy-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: actproxy-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.5

File hashes

Hashes for actproxy-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ca54d617c1a5f082b23cbbdabb7f08c76548e008ff00d56450e91dfe5c4bd837
MD5 5edfa8e4c89f44b4c18288a3bfda700a
BLAKE2b-256 26b6b8931e3bb95d228f382c91405502ec1dbfda033eec7ed97481f27e911375

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page