Skip to main content

A Python library for easiest HTTP requests, handling automatic retries, browser-like headers and built on the official `requests` library for reliability.

Project description

Easy-Requests

publishing workflow

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

easy_reqeusts-1.1.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_reqeusts-1.1.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file easy_reqeusts-1.1.3.tar.gz.

File metadata

  • Download URL: easy_reqeusts-1.1.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easy_reqeusts-1.1.3.tar.gz
Algorithm Hash digest
SHA256 0ee7348754a178967278d7e3f14fc1722628cfa8e29dd0681a38b8bc95b2601b
MD5 185160789e25c4116c586c57fb24f950
BLAKE2b-256 1c4ecbd910e3c621e5f2add1d3264f471739eae2ed116b72889c18f0048a3a32

See more details on using hashes here.

File details

Details for the file easy_reqeusts-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: easy_reqeusts-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for easy_reqeusts-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2d4d98b65a9908cc82a7b1d5319884f69b3a43c817827deb179881437746e9f3
MD5 ec0187deaaa835ba4a17fb1e8e318781
BLAKE2b-256 3bba45e9e38396fb8ae8ca28bc3378bbacfe94f840fad457a93bce47b9f31571

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 Pingdom Monitoring Sentry Error logging StatusPage Status page