Configuration
Client Setup
import os
from askpablos_api import AskPablos
client = AskPablos(
api_key=os.getenv("ASKPABLOS_API_KEY"),
secret_key=os.getenv("ASKPABLOS_SECRET_KEY")
)
Request Options
All options available on client.get():
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
str |
required |
Target URL to fetch |
|
dict |
None |
Custom request headers |
|
dict |
None |
URL query parameters |
|
bool |
False |
Enable browser/JS rendering |
|
bool |
False |
Capture page screenshot (requires |
|
list |
None |
Browser operations (e.g. |
|
int |
30 |
Seconds before request times out |
|
int |
3 |
Retry attempts on failure |
Browser Operations
Use operations to interact with the page before HTML is captured:
response = client.get(
url="https://example.com",
browser=True,
operations=[{
"task": "waitForElement",
"match": {
"on": "xpath",
"rule": "visible",
"value": "//div[@id='content']"
}
}],
timeout=45
)
Logging
import logging
from askpablos_api import configure_logging
configure_logging(level=logging.DEBUG)