Socket
Book a DemoInstallSign in
Socket

easy-requests

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

pipPyPI
Version
1.1.2
Maintainers
1

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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.