Skip to main content

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

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_requests-1.1.2.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

easy_requests-1.1.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

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

Hashes for easy_requests-1.1.2.tar.gz
Algorithm Hash digest
SHA256 7d6055c8f39d0c925662aa68042eb5078270e2d9fa7b8ed86c98aa9223990d27
MD5 68cc9ea3ccbf041ca65749544b0c18c9
BLAKE2b-256 bfff19d5cfdea37aac7ff09f9d65b8c0e0697eaef3092b77107a281d0323a511

See more details on using hashes here.

Provenance

The following attestation bundles were made for easy_requests-1.1.2.tar.gz:

Publisher: python-publish.yml on hazel-noack/easy-requests

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for easy_requests-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 17900fc870d2b7d05b6e982b2ec9c6583814529b01615b968e96a39ea4fc612a
MD5 99dd5ddf8947dc20816e46344ca862b1
BLAKE2b-256 adb7f45ce87ca30e7238b2e37a25264cf83138b82b3333b1c32246d95b801d7c

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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