Crawlbase API middleware for Scrapy
Processes Scrapy requests using Crawlbase services either with Normal or Javascript tokens
Installing
Choose a way of installing:
- Clone the repository inside your Scrapy project and run the following:
python setup.py install
- Or use PyPi Python package manager.
pip install scrapy-crawlbase-middleware
Then in your Scrapy settings.py add the following lines:
# Activate the middleware
CRAWLBASE_ENABLED = True
# The Crawlbase API token you wish to use, either normal of javascript token
CRAWLBASE_TOKEN = 'your token'
# Enable the middleware
DOWNLOADER_MIDDLEWARES = {
'scrapy_crawlbase.CrawlbaseMiddleware': 610
}
Usage
Use the scrapy_crawlbase.CrawlbaseRequest instead of the scrapy built-in Request. The scrapy_crawlbase.CrawlbaseRequest accepts additional arguments, used in Proxy Crawl API:
from scrapy_crawlbase import CrawlbaseRequest
class ExampleScraper(Spider):
def start_requests(self):
yield CrawlbaseRequest(
"http://target-url",
callback=self.parse_result
device='desktop',
country='US',
page_wait=1000,
ajax_wait=True,
dont_filter=True
)
The target url will be replaced with proxy crawl url and parameters will be encoded into the url by the middleware automatically.
If you have questions or need help using the library, please open an issue or contact us.
Copyright 2023 Crawlbase
Metadata
Release files for scrapy-crawlbase-middleware 1.0.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 | Actions |
|---|---|---|---|---|
| scrapy-crawlbase-middleware-1.0.0.tar.gz | 5.0 kB | Without provenance | Details for scrapy-crawlbase-middleware-1.0.0.tar.gz |
Release files / scrapy-crawlbase-middleware-1.0.0.tar.gz
| Download URL | scrapy-crawlbase-middleware-1.0.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65caf98bd4d842be76ca72420b09c04b30e9fa650b51b3572378844b742a7aff
|
|
BLAKE2b-256 checksum How to use checksums |
ea01a84968a50b3e15e77b17c97ecee416f308c5249aa9cbe76c7418da3cee5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.2.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.18
|
Security for scrapy-crawlbase-middleware 1.0.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.