Skip to main content

Python SDK for Scrahub

Project description

Scrahub 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 Scrahub.

The installation of the CLI Tool is simple:

pip install scrahub-sdk

Then, you can use the scrahub command in the command prompt to action with Scrahub.

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

scrahub --help

Utility Tools

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

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

⚠️Note: make sure you have already installed scrahub-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 = {
    'scrahub.pipelines.ScrahubMongoPipeline': 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 scrahub import save_item

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

# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrahub-sdk-0.3.3.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrahub_sdk-0.3.3-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file scrahub-sdk-0.3.3.tar.gz.

File metadata

  • Download URL: scrahub-sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.16

File hashes

Hashes for scrahub-sdk-0.3.3.tar.gz
Algorithm Hash digest
SHA256 ccfb08792c5e35ecaae20a820572aa075d742050536f0f9554b330f68ba430ba
MD5 b48d4236890a2a531b4fb1511fa532ae
BLAKE2b-256 643dda27dfc49a5ab1c7cb632e952f6768956f0da152ecaaf597679bb11309e0

See more details on using hashes here.

File details

Details for the file scrahub_sdk-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: scrahub_sdk-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.16

File hashes

Hashes for scrahub_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a6f4d7e2ea7efce7998e435e2efc5c4a5938f6821f81191dadc1c204de9c36bb
MD5 7a9ec165ffef3097d4e880a6fe089acc
BLAKE2b-256 ef1320cb45c1bebc0be5a014175d215463271b20e94a00935c4768a3a0177ac5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page