scrapy-requests-spider-closed is an extension to make requests when the spider is closed
Project description
scrapy-requests-spider-closed
scrapy-requests-spider-closed is an extension to make requests when the spider is closed.
Use cases:
- You must make a request to an API when the spider is closed.
- You make a request to an API when the scraping is finished, your API will create a report with the data scraped.
- Etc.
Installation
Install scrapy-requests-spider-closed using pip:
pip install git+https://github.com/XavierZambrano/scrapy-requests-spider-closed.git
Configuration
- Add the
REQUESTS_SPIDER_CLOSED_REASONS_TRIGGERin yoursettings.pyfile.
REQUESTS_SPIDER_CLOSED_REASONS_TRIGGER = ['finished', 'cancelled', 'shutdown']
The REQUESTS_SPIDER_CLOSED_REASONS_TRIGGER is a list of reasons that will trigger the requests. reasons.
- Add the
REQUESTS_SPIDER_CLOSED_REQUESTS_PARAMETERSin yoursettings.pyfile.
REQUESTS_SPIDER_CLOSED_REQUESTS_PARAMETERS = [
{
'method': 'POST',
'url': 'https://myapi-xxx.com/endpoint',
}
]
You can use any parameter that the requests library accepts.
- Enable
SpiderClosedRequestsby adding it to theEXTENSIONSin yoursettings.pyfile.
EXTENSIONS = {
"scrapy_requests_spider_closed.RequestsSpiderClosed": 0,
}
Project details
Release history Release notifications | RSS feed
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_requests_spider_closed-0.0.1.tar.gz.
File metadata
- Download URL: scrapy_requests_spider_closed-0.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d865c331cbb89ab787966a3086cb9e2dbbbc0e0a5b83204782a2063201b55aa
|
|
| MD5 |
61ecbaab2ebbdb87277e24a2557cfec6
|
|
| BLAKE2b-256 |
5ac67d40f7ee40713f85d73e4b2be47e43b54e3ff115c6894b096f89459ab361
|
File details
Details for the file scrapy_requests_spider_closed-0.0.1-py3-none-any.whl.
File metadata
- Download URL: scrapy_requests_spider_closed-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d913acd769117fc0e358b14ca9d0f916ca70428446df4bacffac14b0f1b5e113
|
|
| MD5 |
dc7b6755aab0ce3999b76c27c1926b28
|
|
| BLAKE2b-256 |
8ab122a5c8b616b91f000421af37f3401dc0ae7426db42f0581a21ade0e06808
|