Scrapy Inline Requests
This module provides a decorator that allows to write coroutine-like spider callbacks.
The code is experimental, might not work in all cases and even might be hard to debug.
Example:
from inline_requests import inline_requests
class MySpider(CrawlSpider):
...
@inline_requests
def parse_item(self, response):
item = self.build_item(response)
# scrape more information
response = yield Request(response.url + '?info')
item['info'] = self.extract_info(response)
# scrape pictures
response = yield Request(response.url + '?pictures')
item['pictures'] = self.extract_pictures(response)
# a request that might fail (dns error, network timeout, error 404/500, etc)
try:
response = yield Request(response.url + '?protected')
except Exception as e:
log.err(e, spider=self)
else:
item['protected'] = self.extract_protected_info(response)
# finally yield the item
yield item
Example Project
The example directory includes a example spider for StackOverflow.com:
cd example scrapy crawl stackoverflow
Requirements
Python 2.7+, 3.4+
Scrapy 1.0+
Known Issues
Middlewares can drop or ignore non-200 status responses causing the callback to not continue its execution. This can be overcome by using the flag handle_httpstatus_all. See the httperror middleware documentation.
High concurrency and large responses can cause higher memory usage.
Metadata
Release files for scrapy-inline-requests 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| scrapy-inline-requests-0.2.0.tar.gz | 2.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scrapy_inline_requests-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / scrapy-inline-requests-0.2.0.tar.gz
| Download URL | scrapy-inline-requests-0.2.0.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8995ab28eab9aaa5324f0a11bc2197ad39e952413d038f2b4e4051a4855bd5a
|
|
BLAKE2b-256 checksum How to use checksums |
8eb49691dde4dc2092d6211b128caf23069d6e36815ac839eed70ff28b46d151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / scrapy_inline_requests-0.2.0-py2.py3-none-any.whl
| Download URL | scrapy_inline_requests-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
5a827bb1e8f287e80be29b003edb7957a07fb11278c44ea2e74c12f708b56fdd
|
|
BLAKE2b-256 checksum How to use checksums |
404bfc449f58847a67f140d0c48c014138f863f5c4d36672a3cb7bdf3757d9b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for scrapy-inline-requests 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.