Auto GET/POST web scraping helper for Python requests.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crawlquest-0.1.2.tar.gz.
File metadata
- Download URL: crawlquest-0.1.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e09399c5abccc3290b63c1bc646a81af5ce4e2ad7aff185cc6569a574f70563
|
|
| MD5 |
f646c9b7fd9b236135045e309948b67c
|
|
| BLAKE2b-256 |
83993bef6b36307de47da899ed0885841c3a0c84889309e113de031832d6f0ab
|
Provenance
The following attestation bundles were made for crawlquest-0.1.2.tar.gz:
Publisher:
publish.yml on leewr9/crawlquest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crawlquest-0.1.2.tar.gz -
Subject digest:
1e09399c5abccc3290b63c1bc646a81af5ce4e2ad7aff185cc6569a574f70563 - Sigstore transparency entry: 249186948
- Sigstore integration time:
-
Permalink:
leewr9/crawlquest@4e6870c458ed84613778610e6e583985ce7094ad -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/leewr9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e6870c458ed84613778610e6e583985ce7094ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file crawlquest-0.1.2-py3-none-any.whl.
File metadata
- Download URL: crawlquest-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
083d94308a592b619413edbfeb7c426c368fed05ebee92909a7e59f0fc609803
|
|
| MD5 |
797dc76d2084f44c7c54d4632e1f1586
|
|
| BLAKE2b-256 |
a8c44e6aa7d40d4254e1d2dc31705c1ddab7a0d77041de2f4840c12ea4b47e1d
|
Provenance
The following attestation bundles were made for crawlquest-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on leewr9/crawlquest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crawlquest-0.1.2-py3-none-any.whl -
Subject digest:
083d94308a592b619413edbfeb7c426c368fed05ebee92909a7e59f0fc609803 - Sigstore transparency entry: 249186949
- Sigstore integration time:
-
Permalink:
leewr9/crawlquest@4e6870c458ed84613778610e6e583985ce7094ad -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/leewr9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@4e6870c458ed84613778610e6e583985ce7094ad -
Trigger Event:
release
-
Statement type: