SDKs overview
ProxyKingdom offers various tools to facilitate integration with its proxy services, primarily through official SDKs and community-contributed libraries. These SDKs are designed to simplify the process of routing network requests through ProxyKingdom's infrastructure, which includes residential proxies, datacenter proxies, and ISP proxies. Developers can use these tools to manage proxy connections, handle authentication, and optimize request routing for applications requiring robust proxy management, such as web scraping, data collection, and ad verification.
The core functionality of ProxyKingdom's service relies on standard HTTP/HTTPS proxy protocols. Therefore, while SDKs provide convenience, direct integration is also possible using any programming language that supports HTTP client libraries. The SDKs typically abstract the underlying proxy configuration, allowing developers to focus on their application logic rather than low-level network details. Authentication for ProxyKingdom services generally involves a username and password, which are passed as part of the proxy connection details.
Official SDKs by language
ProxyKingdom provides official SDKs to streamline the integration of its proxy services into common development environments. These SDKs are maintained by ProxyKingdom and are designed to offer stable and supported methods for interacting with their proxy network. The primary official SDKs are available for Python and Node.js, reflecting popular choices for web development and data processing tasks.
| Language | Package Name | Install Command | Maturity |
|---|---|---|---|
| Python | proxykingdom-python-sdk |
pip install proxykingdom-python-sdk |
Stable |
| Node.js | @proxykingdom/node-sdk |
npm install @proxykingdom/node-sdk |
Stable |
These official SDKs abstract the complexities of proxy rotation, session management, and error handling, providing a higher-level interface for developers. For detailed API references and usage guidelines, developers should consult the official ProxyKingdom documentation.
Installation
Installing ProxyKingdom's official SDKs typically follows the standard package management practices for their respective languages. For Python, the pip package installer is used, while Node.js projects utilize npm.
Python SDK Installation
To install the official Python SDK for ProxyKingdom, open your terminal or command prompt and execute the following command:
pip install proxykingdom-python-sdk
This command fetches the latest version of the proxykingdom-python-sdk package from the Python Package Index (PyPI) and installs it into your Python environment. Ensure you have Python and pip installed before proceeding.
Node.js SDK Installation
For Node.js projects, the official SDK is installed via npm. Navigate to your project directory in the terminal and run:
npm install @proxykingdom/node-sdk
This command adds @proxykingdom/node-sdk to your project's node_modules directory and updates your package.json file. Ensure you have Node.js and npm installed on your system.
Quickstart example
The following quickstart examples demonstrate how to make a basic HTTP GET request using ProxyKingdom's services through their respective official SDKs. These examples illustrate the fundamental setup for routing a request through a ProxyKingdom proxy.
Python Quickstart
This Python example uses the requests library in conjunction with the proxykingdom-python-sdk to route a GET request through a configured proxy. Replace YOUR_USERNAME and YOUR_PASSWORD with your actual ProxyKingdom credentials.
import requests
from proxykingdom_python_sdk import ProxyKingdomClient
# Initialize the ProxyKingdom client with your credentials
# For specific proxy types (residential, datacenter, ISP), refer to ProxyKingdom documentation
client = ProxyKingdomClient(username="YOUR_USERNAME", password="YOUR_PASSWORD")
# Get a proxy URL from the client
proxy_url = client.get_proxy_url(proxy_type="residential") # Example: 'residential', 'datacenter', 'isp'
proxies = {
"http": proxy_url,
"https": proxy_url,
}
try:
response = requests.get("http://httpbin.org/ip", proxies=proxies, timeout=10)
response.raise_for_status() # Raise an exception for HTTP errors
print(f"Proxy IP: {response.json().get('origin')}")
print(f"Status Code: {response.status_code}")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
This snippet initializes the ProxyKingdomClient, retrieves a proxy URL for a specified type (e.g., residential), and then uses it with the popular Python Requests library to fetch an external IP address, verifying the proxy's operation.
Node.js Quickstart
This Node.js example uses the @proxykingdom/node-sdk with the built-in https module (or a library like axios with proxy support) to make a proxied request. Replace placeholders with your credentials.
const { ProxyKingdomClient } = require('@proxykingdom/node-sdk');
const axios = require('axios'); // Using axios for simpler HTTP requests
async function makeProxiedRequest() {
// Initialize the ProxyKingdom client with your credentials
const client = new ProxyKingdomClient({
username: 'YOUR_USERNAME',
password: 'YOUR_PASSWORD',
});
// Get a proxy URL from the client
const proxyUrl = client.getProxyUrl({ proxyType: 'residential' }); // Example: 'residential', 'datacenter', 'isp'
try {
const response = await axios.get('http://httpbin.org/ip', {
proxy: {
protocol: proxyUrl.split('://')[0],
host: proxyUrl.split('://')[1].split(':')[0],
port: parseInt(proxyUrl.split(':')[2]),
auth: {
username: 'YOUR_USERNAME',
password: 'YOUR_PASSWORD',
},
},
timeout: 10000,
});
console.log(`Proxy IP: ${response.data.origin}`);
console.log(`Status Code: ${response.status}`);
} catch (error) {
console.error(`An error occurred: ${error.message}`);
}
}
makeProxiedRequest();
This Node.js example demonstrates how to configure axios to use the proxy URL provided by the @proxykingdom/node-sdk. It then performs a GET request to httpbin.org/ip to display the origin IP address, confirming the proxy connection.
Community libraries
Beyond the official SDKs, the broader developer community often creates and maintains libraries that integrate with proxy services like ProxyKingdom. These community-contributed tools can offer alternative approaches, specialized functionalities, or support for languages not covered by official SDKs. While not officially supported by ProxyKingdom, they can be valuable resources for developers seeking specific implementations or integrations.
When using community libraries, it is important to assess their maintenance status, documentation, and community support. Developers should verify that the library adheres to secure coding practices and is compatible with the latest ProxyKingdom service specifications, referring to the official ProxyKingdom API documentation for current requirements.
Examples of common community-driven patterns for proxy integration include:
- Generic HTTP Client Wrappers: Libraries that act as a wrapper around standard HTTP clients (e.g.,
requestsin Python,axiosin Node.js) to automatically inject proxy configurations and authentication headers. - Proxy Rotation Middleware: Tools that manage a pool of proxies, rotating them for each request or based on specific criteria to avoid detection or rate limiting.
- Language-Specific Implementations: Libraries written in languages without official SDKs (e.g., Go, Ruby, PHP) that provide functions to construct and manage proxied requests.
Developers are encouraged to explore community forums, GitHub repositories, and package managers (like PyPI or npm) for such contributions. Always review the source code and ensure the library's approach aligns with security best practices, particularly concerning credential handling.