PyProxy API
A TypeScript wrapper for the PyProxy Reseller API.
Installation
npm install pyproxy-api
Usage
import { PyProxy } from 'pyproxy-api';
// Initialize with your API token
const pyproxy = new PyProxy('your-py-account', 'your-api-key');
// Examples
// Get user information
async function getUserInfo() {
try {
const userInfo = await pyproxy.user_info({ id: '12345' });
console.log(userInfo);
} catch (error) {
console.error('Error fetching user info:', error);
}
}
// Create a new user
async function createUser() {
try {
const newUser = await pyproxy.create_user({
username: 'testuser',
email: 'test@example.com',
password: 'password123',
status: 1
});
console.log(newUser);
} catch (error) {
console.error('Error creating user:', error);
}
}
// Get country list
async function getCountries() {
try {
const countries = await pyproxy.get_country_list();
console.log(countries);
} catch (error) {
console.error('Error fetching countries:', error);
}
}
API Reference
Initialization
const pyproxy = new PyProxy('your-api-token');
Methods
user_info(options)
- Get user informationcreate_user(options)
- Create a new usercreate_proxy_account(options)
- Create a proxy accountget_proxy_account_list(options)
- Get list of proxy accountsdelete_proxy_account(options)
- Delete a proxy accountdistribute_flow(options)
- Distribute flowflow_order_list(options)
- Get flow order listadd_white_ip(options)
- Add a white IPdel_white_ip(options)
- Delete a white IPget_white_ip_list(options)
- Get list of white IPsget_user_traffic_usage_log(options)
- Get user traffic usage logget_country_list()
- Get list of countries
License
MIT