scrapy-hrequests
A Scrapy download handler that uses hrequests instead of Scrapy's default HTTP downloader. This allows you to use hrequests seamlessly within your existing Scrapy spiders without changing your crawling logic.
Features
- Simple integration with Scrapy
- Supports both HTTP and HTTPS requests
- Drop-in replacement for Scrapy's default download handler
- Uses the
hrequestslibrary for making requests
Installation
pip install scrapy-hrequests
Usage
Configure your spider (or project) to use the HRequestsDownloadHandler.
Per Spider
import scrapy
class ExampleSpider(scrapy.Spider):
name = "example"
custom_settings = {
"DOWNLOAD_HANDLERS": {
"http": "scrapy_hrequests.handler.HRequestsDownloadHandler",
"https": "scrapy_hrequests.handler.HRequestsDownloadHandler",
},
}
start_urls = [
"https://httpbin.org/get",
]
def parse(self, response):
yield {
"url": response.url,
"status": response.status,
}
Project Wide
Add the following to your settings.py:
DOWNLOAD_HANDLERS = {
"http": "scrapy_hrequests.handler.HRequestsDownloadHandler",
"https": "scrapy_hrequests.handler.HRequestsDownloadHandler",
}
Requirements
- Python 3.8+
- Scrapy
- hrequests
License
MIT License
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 scrapy_hrequests-0.1.9.tar.gz.
File metadata
- Download URL: scrapy_hrequests-0.1.9.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7eedead1816b990c143769ae239c1d764302c1904f625384d18448dc5e51fc84
|
|
| MD5 |
8beab55e62d7c650b72ebd20ea85b826
|
|
| BLAKE2b-256 |
061e4c4daf9c47cf82a9b85db17cc13b0445458ecd702e5e96eddf2f53c7344b
|
File details
Details for the file scrapy_hrequests-0.1.9-py3-none-any.whl.
File metadata
- Download URL: scrapy_hrequests-0.1.9-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b91099c897be1386429afc30324cd9ce31bed9782baf85c0ed618d1715276c17
|
|
| MD5 |
67006d274c9be283c114983e8d01a62e
|
|
| BLAKE2b-256 |
fc78dc8f7389cf7047b1fa65a2169242a9d916c2c7b04581cf013b4456e22e02
|