semvec/pypi-packages huggingface dataset:
smartrequests 0.1.1
A smart wrapper over requests with built-in delays and headers.
Requires Python: >=3.6

# smartrequests 🚀

A smart, lightweight wrapper over Python’s popular `requests` library — with built-in delays and a Googlebot-style user-agent to mimic human or bot-like behavior.

---

## 🔍 Why smartrequests?

Web crawling, scraping, and SEO testing often require:
- Respectful delays to avoid rate-limiting
- Realistic headers like search engine bots
- Simple, scriptable interface

**`smartrequests`** solves this with:
- ✅ Randomized delay per request
- ✅ Googlebot-style `User-Agent`
- ✅ Simple plug-and-play interface
- ✅ CLI support via `smartreq` command

---

## ✨ Features

- 🕒 Auto-delay between requests (0.5s to 1.5s)
- 🕵️‍♂️ Custom `User-Agent`: `SmartBot/1.0 (like Googlebot)`
- 🔗 Drop-in replacement for `requests.Session()`
- 🔧 Command-line support (`smartreq <URL>`)
- 📦 Lightweight, no extra dependencies except `requests`

---

## 📦 Installation

```bash
pip install smartrequests
```

---

## ⚙️ Usage (Python)

```python
from smartrequests import SmartSession

session = SmartSession()
response = session.get("https://example.com")

print(response.status_code)
print(response.text[:500])  # Preview first 500 chars
```

---

## 🖥️ Usage (CLI)

```bash
smartreq https://example.com
```

**Output:**

```
[smartrequests] GET https://example.com (delay 0.92s)
200
<!DOCTYPE html> ...
```

---

## 📄 License

MIT License © 2025 Amal Alexander