Skip to main content

Proxy6 API wrapper

Project description

Proxy6 API wrapper

Unofficial API wrapper for proxy6.net using pydantic

Installation

pip install proxy6net-api

Basic usage

Get your API token here

Create API wrapper instance

from proxy6net_api import Proxy6API

api = Proxy6API(auth_token='your_token')

Get balance

balance = api.get_balance()
f'{balance.balance=}, {balance.currency=}'

# balance.balance = 518.20, balance.currency='RUB'

Buy proxies

purchase = api.buy_proxies(count=3, days=5, country_code='ru', ipv='IPV6', protocol='http')
len(purchase.proxies)

# 3

Use proxy

import requests

proxy = api.get_proxies(state='active')[0]
response = requests.get('https://api64.ipify.org?format=json', proxies={'http': str(proxy), 'https': proxy.url})

assert response.json()['ip'] == proxy.ip

Other methods

help(Proxy6API)

Error handling

from proxy6net_api import Proxy6Exception

try:
    proxies = Proxy6API(auth_token='invalid token').get_proxies()
except Proxy6Exception as err:
    print(f'Error description: {err.description}. Error code: {err.code}')
    
    # Error description: Authorization error, wrong key. Error code: 100

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

proxy6net-api-1.0.0.tar.gz (9.5 kB view hashes)

Uploaded Source

Built Distribution

proxy6net_api-1.0.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

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