Skip to main content

AskPablos API Client

PyPI Version PyPI Downloads Supported Python Versions License: MIT GitHub Issues

A Python client for making GET and POST requests through the AskPablos proxy service with browser automation support.

Documentation: https://askpablos-api.readthedocs.io/

Features

  • Secure Authentication — HMAC-SHA256 signature-based
  • Browser Automation — JavaScript rendering with browser=True
  • Browser Operations — Wait for elements with waitForElement before capturing HTML
  • Screenshot Capturescreenshot=True
  • Error Handling — Specific exception types for each failure mode

Installation

pip install askpablos-api

# With lxml for HTML/XPath parsing
pip install "askpablos-api[parsing]"

Quick Start

from askpablos_api import AskPablos

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

# Simple request
response = client.get("https://httpbin.org/ip")
print(response.content)

Browser Mode & HTML Parsing

For JavaScript-rendered pages, use browser=True with operations to wait for content before capturing. Use lxml to parse the HTML.

from lxml import etree

response = client.get(
    url="https://example.com/catalog",
    browser=True,
    operations=[{
        "task": "waitForElement",
        "match": {
            "on": "xpath",
            "rule": "visible",
            "value": "//ul[@class='prod_list']"
        }
    }],
    timeout=45
)

dom = etree.HTML(response.content)
for li in dom.xpath("//ul[@class='prod_list']/li"):
    name = li.xpath(".//span[@class='pr_title']/text()")
    print(name[0].strip() if name else "")

Screenshot

response = client.get(
    url="https://example.com",
    browser=True,
    screenshot=True
)

if response.screenshot:
    with open("screenshot.png", "wb") as f:
        f.write(response.screenshot)

Error Handling

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

try:
    response = client.get("https://example.com", timeout=30)
except AuthenticationError as e:
    print(f"Auth failed: {e}")
except APIConnectionError as e:
    print(f"Connection error: {e}")
except RequestTimeoutError as e:
    print(f"Timed out: {e}")
except ResponseError as e:
    print(f"HTTP error: {e}")

Development

git clone https://github.com/fawadss1/askpablos_api.git
cd askpablos-api
pip install -e ".[dev]"

License

MIT — see LICENSE for details.

Support

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.5.0.tar.gz (17.9 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.5.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: askpablos_api-0.5.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for askpablos_api-0.5.0.tar.gz
Algorithm Hash digest
SHA256 56990f1300a86ecd36c5424efb6a929dd7d362a48d289faae871342695e11903
MD5 5a9284931f9c7a203d7b11f57aaf6826
BLAKE2b-256 ac67f9e042a57ab5e39d7dc7fe36ced001a2a15e1bd17d9fb4799ef531c44c2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: askpablos_api-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for askpablos_api-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fa2adc892213f887c073fce0f33643260c3921b623e1d434f0e2b814edcebc3
MD5 3fd396106c7f4e8f027c93c49b5ed787
BLAKE2b-256 e09cae034794f191475740bb0cd9954a2ee9ae3aaf329409d41b33d07c7f504c

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 Sentry Error logging StatusPage Status page