Skip to main content

Professional Python client for the AskPablos proxy API service

Project description

AskPablos API Client

PyPI Version Supported Python Versions

A simple Python client for making GET requests through the AskPablos proxy API service. This library provides a clean and easy-to-use interface for fetching web pages and APIs through the AskPablos proxy infrastructure.

Features

  • 🔐 Secure Authentication: HMAC-SHA256 signature-based authentication
  • 🌐 Proxy Support: Route requests through rotating proxies
  • 🤖 Browser Integration: Support for JavaScript-heavy websites
  • 🛡️ Error Handling: Comprehensive exception handling
  • 📊 Logging: Built-in logging support for debugging
  • 🎯 Simple Interface: GET-only requests for clean API

Installation

pip install askpablos-api

Quick Start

from askpablos_api import AskPablos

# Initialize the client
client = AskPablos(
    api_key="your_api_key",
    secret_key="your_secret_key"
)

# Make a simple GET request
response = client.get("https://httpbin.org/ip")
print(response)

Authentication

The AskPablos API uses HMAC-SHA256 signature-based authentication. You only need:

  1. API Key: Your unique API identifier
  2. Secret Key: Your private key for signing requests
from askpablos_api import AskPablos

client = AskPablos(
    api_key="your_api_key",
    secret_key="your_secret_key"
)

Usage Examples

Basic GET Requests

# Simple GET request
response = client.get("https://example.com")

# GET with query parameters
response = client.get(
    "https://api.example.com/users",
    params={"page": 1, "limit": 10}
)

# GET with custom headers
response = client.get(
    "https://api.example.com/data",
    headers={"Authorization": "Bearer token123"}
)

Advanced Options

# Use browser automation for JavaScript-heavy sites
response = client.get(
    "https://spa-website.com",
    browser=True
)

# Disable proxy rotation
response = client.get(
    "https://example.com",
    rotate_proxy=False
)

# Custom user agent and cookies
response = client.get(
    "https://example.com",
    user_agent="Mozilla/5.0 (Custom Bot)",
    cookies={"session": "abc123"}
)

# Custom timeout
response = client.get(
    "https://slow-website.com",
    timeout=60
)

Error Handling

from askpablos_api import (
    AskPablos, 
    AuthenticationError, 
    APIConnectionError, 
    ResponseError
)

try:
    client = AskPablos(api_key="", secret_key="")
except AuthenticationError as e:
    print(f"Authentication failed: {e}")

try:
    response = client.get("https://example.com")
except APIConnectionError as e:
    print(f"Connection failed: {e}")
except ResponseError as e:
    print(f"API error {e.status_code}: {e.message}")

Logging

from askpablos_api import configure_logging
import logging

# Enable debug logging
configure_logging(level=logging.DEBUG)

client = AskPablos(api_key="...", secret_key="...")
response = client.get("https://example.com")  # This will be logged

API Reference

AskPablos Class

The main interface for the API client.

Constructor

AskPablos(api_key: str, secret_key: str)

Parameters:

  • api_key (str): Your API key from the AskPablos dashboard
  • secret_key (str): Your secret key for HMAC signing

Methods

get()
get(url, params=None, headers=None, browser=False, rotate_proxy=True, timeout=30, **options)

Send a GET request through the AskPablos proxy.

Parameters:

  • url (str): Target URL to fetch
  • params (dict, optional): URL query parameters
  • headers (dict, optional): Custom headers
  • browser (bool, optional): Use browser automation (default: False)
  • rotate_proxy (bool, optional): Enable proxy rotation (default: True)
  • timeout (int, optional): Request timeout in seconds (default: 30)
  • **options: Additional options like user_agent, cookies, etc.

Returns: Dictionary containing the API response

Exception Classes

  • AskPablosError - Base exception class
  • AuthenticationError - Authentication-related errors
  • APIConnectionError - Connection and network errors
  • ResponseError - API response errors

Response Format

All successful requests return a dictionary with:

{
    "status_code": 200,
    "headers": {"content-type": "text/html", ...},
    "content": "Response body content",
    "url": "Final URL after redirects",
    "proxy_used": "proxy.example.com:8080",
    "time_taken": 1.23
}

Requirements

  • Python 3.9+
  • requests >= 2.25.0

License

This project is licensed under the MIT License.

Support

For support and questions:

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

askpablos_api-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

askpablos_api-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file askpablos_api-0.1.0.tar.gz.

File metadata

  • Download URL: askpablos_api-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for askpablos_api-0.1.0.tar.gz
Algorithm Hash digest
SHA256 114195270083fcb0cb5b0b4da63d0e8b1d71dcbba53034fa194f48ba5e779e7e
MD5 6d282078c6ddcf45a826de1be754d148
BLAKE2b-256 8fc71f4721b69051e64243b9f8d2d4bc1ed8f201cca0c70742c06ac8d4cb9236

See more details on using hashes here.

File details

Details for the file askpablos_api-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: askpablos_api-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for askpablos_api-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24e9920b91cf7c7c1eca7d656f75069b7c9684161c29b9e971753625ffc471d2
MD5 2e557310cc19c45acf7b82a07ceb3444
BLAKE2b-256 657b86e3b8807b6e39b73f09326650682fc6d1af6817307d5f8d4221883c89cf

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