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 Capture — screenshot=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

Metadata

Release files for askpablos-api 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for askpablos-api 0.5.1
File Size Uploaded
askpablos_api-0.5.1.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for askpablos-api 0.5.1
File Interpreter ABI Platform
askpablos_api-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 35.6 kB

Release files / askpablos_api-0.5.1.tar.gz

Download URL askpablos_api-0.5.1.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
46ece4e2e64b8d4aec3f5c97cad7101c5fba26024794d3b4661a6b07f9f6edbc
BLAKE2b-256 checksum
How to use checksums
3f89289063cb1c6665045677c95dbdfb2b3b2a1553d99211d6781ef4d3c44294
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / askpablos_api-0.5.1-py3-none-any.whl

Download URL askpablos_api-0.5.1-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17dc29c8200927953f31fd2acdc1ba5c1a081f2442edf275aae626f1d62ed010
BLAKE2b-256 checksum
How to use checksums
d6c51935d649301b3138444d5957be37a78f59f4dea8104589e1b3e0406a56f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page