CrawlQuest
Lightweight wrapper around Python requests that automatically chooses between GET and POST based on the presence of a payload.
Perfect for web scraping, automation, and crawling tools where fast and adaptive request behavior is needed.
Features
- Automatically uses
GETif no payload,POSTif payload is present - Supports returning JSON, HTML, raw bytes
- Optional
requests.Sessioninjection for cookie/session reuse - Simple API with built-in error handling
- Customizable timeout and headers
Installation
pip install crawlquest
Alternatively, install manually
git clone https://github.com/leewr9/crawlquest.git
cd crawlquest
pip install .
Usage
from crawlquest import json, html, raw
# Automatically POSTs (since payload exists)
res = json("https://httpbin.org/post", payload={"key": "value"})
# Automatically GETs (no payload)
html_content = html("https://example.com")
# Raw bytes (e.g., image or file)
binary = raw("https://httpbin.org/image/png")
Using a persistent session (cookie reuse)
import requests
from crawlquest import json
session = requests.Session()
json("https://httpbin.org/cookies/set?mycookie=value", session=session)
res = json("https://httpbin.org/cookies", session=session)
print(res)
# Output: {'cookies': {'mycookie': 'value'}}
API Reference
json(url, payload=None, headers=None, timeout=10.0, session=None) -> dict | None
- Automatically parses JSON response.
- Returns
Noneif decoding fails.
html(url, ...) -> str
- Returns the text (HTML) of the response.
- Automatically applies
apparent_encodingif needed.
raw(url, ...) -> bytes
- Returns the raw byte content (e.g., for images or binary files).
Error Handling
All internal HTTP calls raise RuntimeError with context on failure
try:
data = json("https://example.com/api")
except RuntimeError as e:
print(f"Request failed: {e}")
License
This project is licensed under the MIT License. See the LICENSE file for details.
Release files for crawlquest 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crawlquest-0.1.3.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crawlquest-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.2 kB
Release files / crawlquest-0.1.3.tar.gz
| Download URL | crawlquest-0.1.3.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
674a5cef6d28ec250294ee2069be7be346220c3ca42bf8d6500f7e49c572b3f2
|
|
BLAKE2b-256 checksum How to use checksums |
7873abf545eb12a55d2413e817ee34b3e49611735946cf30de2bc4dba1aa8218
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 25, 2025.
Transparency logRelease files / crawlquest-0.1.3-py3-none-any.whl
| Download URL | crawlquest-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7f91c6112eda89edc09a1f9e6109ee637d485d1462b43af6740676b92c1a610
|
|
BLAKE2b-256 checksum How to use checksums |
d61a8ddcfedf2efadf4cff54a2c8ae253ca5eae78d2149399c9a6531cad947fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 25, 2025.
Transparency log