https://github.com/jktujg/proxy6net-api
https://github.com/jktujg/proxy6net-api
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jktujg/proxy6net-api
- Owner: jktujg
- License: mit
- Created: 2024-03-11T06:45:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-11T06:46:08.000Z (over 1 year ago)
- Last Synced: 2025-02-08T02:18:51.931Z (4 months ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Proxy6 API wrapper
Unofficial API wrapper for [proxy6.net](https://proxy6.net/) using pydantic## Installation
```commandline
pip install proxy6net-api
```
## Basic usage
Get your API token [here](https://proxy6.net/user/developers)
### Create API wrapper instance```python
from proxy6net_api import Proxy6APIapi = Proxy6API(auth_token='your_token')
```### Get balance
```python
balance = api.get_balance()
f'{balance.balance=}, {balance.currency=}'# balance.balance = 518.20, balance.currency='RUB'
```
### Buy proxies
```python
purchase = api.buy_proxies(count=3, days=5, country_code='ru', ipv='IPV6', protocol='http')
len(purchase.proxies)# 3
```
### Use proxy
```python
import requestsproxy = 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
```python
help(Proxy6API)
```
## Error handling
```python
from proxy6net_api import Proxy6Exceptiontry:
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
```