A Python library for simplified HTTP requests, featuring rate limiting, browser-like headers, and automatic retries. Built on the official `requests` library for reliability.
Project description
Easy-Requests
A Python library for simplified HTTP requests, featuring rate limiting, browser-like headers, and automatic retries. Built on the official requests library for reliability.
Features
- Save responses to cache
- Use any session (e.g., bypass Cloudflare using cloudscraper)
- Configurable wait between requests without thread blocking
- Automatic retries for failed requests
pip install easy-requests
Usage
Basic Usage
from easy_requests import Connection, init_cache
init_cache(".cache")
connection = Connection()
# to generate headers that mimic the browser
connection.generate_headers()
response = connection.get("https://example.com")
Using with Cloudscraper
from easy_requests import Connection
import cloudscraper
connection = Connection(cloudscraper.create_scraper())
response = connection.get("https://example.com")
Configuring cache
This won't use caching without you configuring it.
You can configure the default cache either with environment variables or using init_cache. The env keys are EASY_REQUESTS_CACHE_DIR and EASY_REQUESTS_CACHE_EXPIRES (in days).
from easy_requests import init_cache
init_cache(".cache")
Alternatively you can pass arguments into Connection(...) and the request function:
cache_enabled: Optional[bool]cache_directory: Optional[str]cache_expires_after: Optional[timedelta]
from easy_requests import Connection
Connection(
cache_enabled = True
)
If you pass in cache_enabled=True it will raise a Value error if no cache directory was found.
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 easy_requests-1.1.2.tar.gz.
File metadata
- Download URL: easy_requests-1.1.2.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d6055c8f39d0c925662aa68042eb5078270e2d9fa7b8ed86c98aa9223990d27
|
|
| MD5 |
68cc9ea3ccbf041ca65749544b0c18c9
|
|
| BLAKE2b-256 |
bfff19d5cfdea37aac7ff09f9d65b8c0e0697eaef3092b77107a281d0323a511
|
Provenance
The following attestation bundles were made for easy_requests-1.1.2.tar.gz:
Publisher:
python-publish.yml on hazel-noack/easy-requests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easy_requests-1.1.2.tar.gz -
Subject digest:
7d6055c8f39d0c925662aa68042eb5078270e2d9fa7b8ed86c98aa9223990d27 - Sigstore transparency entry: 388704539
- Sigstore integration time:
-
Permalink:
hazel-noack/easy-requests@d5c3eb1892f2175301432eb4740950ac5d0bdb3a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/hazel-noack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d5c3eb1892f2175301432eb4740950ac5d0bdb3a -
Trigger Event:
push
-
Statement type:
File details
Details for the file easy_requests-1.1.2-py3-none-any.whl.
File metadata
- Download URL: easy_requests-1.1.2-py3-none-any.whl
- Upload date:
- Size: 14.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 |
17900fc870d2b7d05b6e982b2ec9c6583814529b01615b968e96a39ea4fc612a
|
|
| MD5 |
99dd5ddf8947dc20816e46344ca862b1
|
|
| BLAKE2b-256 |
adb7f45ce87ca30e7238b2e37a25264cf83138b82b3333b1c32246d95b801d7c
|
Provenance
The following attestation bundles were made for easy_requests-1.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on hazel-noack/easy-requests
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
easy_requests-1.1.2-py3-none-any.whl -
Subject digest:
17900fc870d2b7d05b6e982b2ec9c6583814529b01615b968e96a39ea4fc612a - Sigstore transparency entry: 388704554
- Sigstore integration time:
-
Permalink:
hazel-noack/easy-requests@d5c3eb1892f2175301432eb4740950ac5d0bdb3a -
Branch / Tag:
refs/tags/v1.1.2 - Owner: https://github.com/hazel-noack
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d5c3eb1892f2175301432eb4740950ac5d0bdb3a -
Trigger Event:
push
-
Statement type: