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

Uploaded Python 3

File details

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

File metadata

  • Download URL: askpablos_api-0.4.0.tar.gz
  • Upload date:
  • Size: 17.3 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.4.0.tar.gz
Algorithm Hash digest
SHA256 a7064be820ca203b3d50eb689f23f85b3807aec8248d6526fcafa8e8cef8c2d2
MD5 99dcbac028b1b7d2af0eb8af7f0de153
BLAKE2b-256 f475de9257cbe764ce9ac791442e02853c244e28fdb7ec9b23b061cd30780e92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: askpablos_api-0.4.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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8faf9d10af61264b8b16684559b17443f238804821e73c448145fb35c5cb239c
MD5 149b5aec3e0fb467c0c65e843c5e3637
BLAKE2b-256 969702e80f967e37c3aecf9d69b0ad0a06a6a91fffffb3b08af4a409305b5079

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