Skip to main content

Crawlab SDK for Python

中文 | English

The SDK for Python contains two parts:

  1. CLI Tool
  2. Utility Tools

CLI Tool

The CLI Tool is mainly designed for those who are more comfortable using command line tools to interact with Crawlab.

The installation of the CLI Tool is simple:

pip install crawlab-sdk

Then, you can use the crawlab command in the command prompt to action with Crawlab.

Check the help document below, or you can refer to the official documentation (Chinese).

crawlab --help

Utility Tools

Utility tools mainly provide some helper methods to make it easier for you to integrate your spiders into Crawlab, e.g. saving results.

Below are integration methods of Scrapy and general Python spiders with Crawlab.

⚠️Note: make sure you have already installed crawlab-sdk using pip.

Scrapy Integration

In settings.py in your Scrapy project, find the variable named ITEM_PIPELINES (a dict variable). Add content below.

ITEM_PIPELINES = {
    'crawlab.pipelines.CrawlabMongoPipeline': 888,
}

Then, start the Scrapy spider. After it's done, you should be able to see scraped results in Task Detail -> Result

General Python Spider Integration

Please add below content to your spider files to save results.

# import result saving method
from crawlab import save_item

# this is a result record, must be dict type
result = {'name': 'crawlab'}

# call result saving method
save_item(result)

Then, start the spider. After it's done, you should be able to see scraped results in Task Detail -> Result

Metadata

Release files for test-crawlab-sdk 0.4.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-crawlab-sdk 0.4.3
File Size Uploaded
test-crawlab-sdk-0.4.3.tar.gz 12.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for test-crawlab-sdk 0.4.3
File Interpreter ABI Platform
test_crawlab_sdk-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 28.9 kB

Release files / test-crawlab-sdk-0.4.3.tar.gz

Download URL test-crawlab-sdk-0.4.3.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d46adbce13c47b61a9234dce7ded184f8c7cd2cbe18b2665aa8ac72d73910747
BLAKE2b-256 checksum
How to use checksums
6fdc225836612195757dc7419b14fd96089316b32879ea68be7e459f6422d928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.6.8

Release files / test_crawlab_sdk-0.4.3-py3-none-any.whl

Download URL test_crawlab_sdk-0.4.3-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e8070dd2f84e4abb7f00c7f18f53f1157d33a41fbbf85eaf0068862e9696f2e
BLAKE2b-256 checksum
How to use checksums
a1d3d4f0735c542e5bbfb5feb39163d18a7cebc2b6bfb63921f812b2b82e76c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/53.1.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page